Skip to content

Conversation

@fatelei
Copy link

@fatelei fatelei commented Nov 21, 2025

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

implement version sub command, give more info

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Copy link
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fatelei, please have a look at the comments and lmk what you think!

Also for this to be merged you'll need so set up commit signing; see https://github.com/apple/containerization/blob/main/CONTRIBUTING.md#pull-requests for details.

VolumeCommand.self
]
),
CommandGroup(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the container CLI we've tried to avoid putting commands not related to container resources directly under container. Could you remove this command group, and make it so that the version command is a subcommand of container system?

}

private func printVersionTable(_ info: VersionInfo) {
print("\(info.appName) version \(info.version)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really tabular format. If we're going to have table and json format (which seems fine to me), the table format should use the TableOutput type that's used in all the resource.list() functions.

The other thing you could do for the table is try doing a ping() call on the API server and that would give you the API server release version if it's up (it should be the same but could differ if for example you did and upgrade and forgot to restart the API server, or had two installs and ran the wrong CLI executable). This could be an option (if the server responds) second row in the table.

If you do that, you could also add the buildType and appName values to what ping() returns for the API server.

}
}

private func buildType() -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about relocating this into a public func in ReleaseVersion.swift?

You could then tweak ReleaseVersion.singleLine() to use ReleaseVersion.buildType() as well.


public struct VersionInfo: Codable {
let version: String
let build: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this buildType so the meaning is a little more obvious.

OPTIONS:
--debug Enable debug output [environment: CONTAINER_DEBUG]
--version Show the version.
version Show detailed version information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moves under system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants