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

Fix client version output with --component option #1408

Merged

Conversation

anshulvermapatel
Copy link
Contributor

@anshulvermapatel anshulvermapatel commented Jun 29, 2021

Resolves #1395

Resolved an issue where the client version with --component option was being
printed same as the output of client version without adding --component

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jun 29, 2021
@tekton-robot tekton-robot requested review from chmouel and hrishin June 29, 2021 18:32
@tekton-robot
Copy link
Contributor

Hi @anshulvermapatel. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 29, 2021
@pradeepitm12
Copy link
Contributor

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 29, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/version/version.go 64.8% 63.4% -1.4

@chmouel
Copy link
Member

chmouel commented Jun 29, 2021

I think we need to test in this command, or move the logic block out of Command in a package in pkg/version for example to better make it testable.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

One comment 👼🏼

if component == "" {
fmt.Fprintf(cmd.OutOrStdout(), "Client version: %s\n", clientVersion)
} else {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", clientVersion)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is right though, because as is, tkn version --component=pipeline with a error connecting kubernetes, it will print the client version without an error, which doesn't make sense to me.

We should print the client version if the component is client, otherwise we should either error out or print unknown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, my bad.
I will correct it.

@anshulvermapatel anshulvermapatel force-pushed the issue/1395/client_version_issue branch from 2da4451 to 37f5b9c Compare July 5, 2021 09:08
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 5, 2021
@anshulvermapatel
Copy link
Contributor Author

@chmouel , made the tests for this better .. still kept the block in cmd itself as it was a small change. Please do suggest once your review.

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/version/version.go 64.8% 73.7% 8.8

@anshulvermapatel
Copy link
Contributor Author

/retest

Resolved an issue where the client version as component was being
printed as the output of client version without adding `--component`
@anshulvermapatel anshulvermapatel force-pushed the issue/1395/client_version_issue branch from 37f5b9c to 8808c7e Compare July 5, 2021 10:13
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/version/version.go 64.8% 73.7% 8.8

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 5, 2021
}
got, _ := test.ExecuteCommand(version, "version", "-n", "test", "--component", c)
fmt.Println(t.Name())
golden.Assert(t, got, fmt.Sprintf("%s-%s.golden", t.Name(), c))
Copy link
Member

Choose a reason for hiding this comment

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

instead of generating golden files can't we just do assert?

Copy link
Member

Choose a reason for hiding this comment

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

I tend to agree with @vinamra28, could be a follow-up though 😉

Copy link
Member

Choose a reason for hiding this comment

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

sure. I'll track this in an issue and merge this one 🙂

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vinamra28
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2021
@vinamra28
Copy link
Member

/retest

1 similar comment
@vinamra28
Copy link
Member

/retest

@piyush-garg
Copy link
Contributor

/lgtm

@piyush-garg
Copy link
Contributor

/test pull-tekton-cli-integration-tests

@piyush-garg
Copy link
Contributor

/retest

@tekton-robot tekton-robot merged commit 56c592e into tektoncd:main Jul 9, 2021
pradeepitm12 added a commit that referenced this pull request Jul 14, 2021
#1409 | [Pradeep Kumar] update readme cli version to v0.19.1 | 2021/06/30-15:54
#1410 | [laminar] Fix CLI installation instructions for deb-based distros | 2021/07/05-10:15
#1393 | [vinamra28] Get tekton components version from configmap | 2021/07/07-09:09
#1411 | [vinamra28] Bump pipelines v0.25.0, triggers 0.14.2 and hub | 2021/07/07-12:05
#1415 | [Vincent Demeester] Force cancel when using tkn pipelinerun cancel 👼 | 2021/07/09-09:48
#1408 | [Anshul Verma] resloves issue/1395 | 2021/07/09-10:12
#1385 | [Nikhil Thomas] Fix TaskRun order in `tkn pr logs` | 2021/07/13-06:13

Signed-off-by: Pradeep Kumar <[email protected]>
pradeepitm12 added a commit to pradeepitm12/cli that referenced this pull request Jul 15, 2021
tektoncd#1409 | [Pradeep Kumar] update readme cli version to v0.19.1 | 2021/06/30-15:54
tektoncd#1410 | [laminar] Fix CLI installation instructions for deb-based distros | 2021/07/05-10:15
tektoncd#1393 | [vinamra28] Get tekton components version from configmap | 2021/07/07-09:09
tektoncd#1411 | [vinamra28] Bump pipelines v0.25.0, triggers 0.14.2 and hub | 2021/07/07-12:05
tektoncd#1415 | [Vincent Demeester] Force cancel when using tkn pipelinerun cancel 👼 | 2021/07/09-09:48
tektoncd#1408 | [Anshul Verma] resloves issue/1395 | 2021/07/09-10:12
tektoncd#1385 | [Nikhil Thomas] Fix TaskRun order in `tkn pr logs` | 2021/07/13-06:13

Signed-off-by: Pradeep Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client version command doesn't work on 0.19.0 release
7 participants