-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
don't use base cmd name when printing client version #12781
don't use base cmd name when printing client version #12781
Conversation
[test] |
The fix needs to be to not allow random names to be used for oc. |
pkg/cmd/cli/cmd/version.go
Outdated
@@ -93,7 +93,7 @@ func (o *VersionOptions) Complete(cmd *cobra.Command, f *clientcmd.Factory, out | |||
|
|||
// RunVersion attempts to display client and server versions for Kubernetes and OpenShift | |||
func (o VersionOptions) RunVersion() error { | |||
fmt.Fprintf(o.Out, "%s %v\n", o.BaseName, version.Get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the right fix, this breaks versions for all the commands that reuse this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider replacing basename
as "oc"
in cli.go:295
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@louyihua Thanks for the suggestion, I have updated the PR
cdf475c
to
cd7b290
Compare
check_future flaked on #12911 re[test] |
cd7b290
to
59e9093
Compare
@@ -292,7 +292,7 @@ func CommandFor(basename string) *cobra.Command { | |||
case "kubectl": | |||
cmd = NewCmdKubectl(basename, out) | |||
default: | |||
cmd = NewCommandCLI(basename, basename, in, out, errout) | |||
cmd = NewCommandCLI("oc", "oc", in, out, errout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still not the right approach. This path is executed by all commands that are build from our repo, this includes oc
, openshift
, oadm
. Make sure to check them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not right. This is the default entry for the oc
series command line utils (currently, oc
only). The entries used by openshift
and oadm
series are not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, you're right, sorry.
[merge] |
This patch addresses an issue where the client name will be printed as what the "base / root" command was when invoking the "version" cmd.
59e9093
to
908676d
Compare
Evaluated for origin test up to 908676d |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/108/) (Base Commit: 8ca7c7b) |
[merge] |
flaked on #8571 re[merge] |
Evaluated for origin merge up to 908676d |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/62/) (Base Commit: 18b1328) (Image: devenv-rhel7_6067) |
Fixes #12768
This patch addresses an issue where the client name will be printed as
what the "base / root" command was when invoking the "version" cmd.
Before
After
cc @soltysh @openshift/cli-review