Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add --client flag to kargo version #1516

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

hiddeco
Copy link
Contributor

@hiddeco hiddeco commented Feb 22, 2024

Fixes: #1511

This adds support for supplying a --client flag to kargo version, which avoids the command from attempting to collect version information from the API server.

$ kargo version --client
Client Version: devel+unknown.dirty

In addition, the order of collecting information has been adjusted to allow partial information to be printed when the API server can not be reached before returning an error.

$ kargo version
Client Version: devel+unknown.dirty
Error: get version info from server: unavailable: dial tcp [::1]:30081: connect: connection refused

$ kargo version --output yaml
apiVersion: kargo.akuity.io/v1alpha1
cli:
  buildTime: "2024-02-22T11:18:51Z"
  compiler: gc
  gitTreeDirty: true
  goVersion: go1.21.3
  platform: linux/amd64
  version: devel+unknown.dirty
kind: ComponentVersions
Error: get version info from server: unavailable: dial tcp [::1]:30081: connect: connection refused

However, in case --output is provided and the printer itself runs into an issue, this error takes precedence.

$ kargo version --output go-template --template '{{ .cli.version }'
Error: new printer: error parsing template {{ .cli.version }, template: output:1: unexpected "}" in operand

This adds support for supplying a `--client` flag to `kargo version`,
which avoids the command from attempting to collect version information
from the API server.

```console
$ kargo version --client
Client Version: devel+unknown.dirty
```

In addition, the order of collecting information has been adjusted to
allow partial information to be printed when the API server can not
be reached before returning an error.

```console
$ kargo version
Client Version: devel+unknown.dirty
Error: get version info from server: unavailable: dial tcp [::1]:30081: connect: connection refused

$ kargo version --output yaml
apiVersion: kargo.akuity.io/v1alpha1
cli:
  buildTime: "2024-02-22T11:18:51Z"
  compiler: gc
  gitTreeDirty: true
  goVersion: go1.21.3
  platform: linux/amd64
  version: devel+unknown.dirty
kind: ComponentVersions
Error: get version info from server: unavailable: dial tcp [::1]:30081: connect: connection refused
```

However, in case `--output` is provided and the printer itself runs
into an issue, this error takes precedence.

```console
$ kargo version --output go-template --template '{{ .cli.version }'
Error: new printer: error parsing template {{ .cli.version }, template: output:1: unexpected "}" in operand
```

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Copy link

netlify bot commented Feb 22, 2024

Deploy Preview for docs-kargo-akuity-io ready!

Name Link
🔨 Latest commit 9c639dd
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/65d72fa3625a8c00086899eb
😎 Deploy Preview https://deploy-preview-1516.kargo.akuity.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hiddeco hiddeco added this pull request to the merge queue Feb 22, 2024
Merged via the queue into akuity:main with commit 32e4e9e Feb 22, 2024
18 checks passed
@hiddeco hiddeco deleted the cli-version-client branch February 22, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kargo CLI should have a --client option
2 participants