-
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
cli: drop support for passing comma-separated template parameters through --param/--value #11539
cli: drop support for passing comma-separated template parameters through --param/--value #11539
Conversation
can we bump to the same level as 1.4 upstream (1560c1005499d61b80f865c04d39ca7505bf7f0b)? https://github.com/kubernetes/kubernetes/blob/release-1.4/Godeps/Godeps.json#L2050-L2053 |
or if this is post-1.4, to whatever is currently in master upstream |
ah, nevermind... looks like 1.4 didn't have stringarray |
@liggitt kubernetes master has c7e63cf4530bcd3ba943729cee0efeff2ebea63f which has StringArray but is missing a bunch of small fixes |
@bparees @smarterclayton PTAL Docs update: openshift/openshift-docs#3107. Does [test] run the cmd tests? |
9312063
to
5f0e901
Compare
It does. [test] again |
Please open an upstream PR bumping to the same version then |
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.
@mmilata does this also resolve the issue of the $(cat foo) syntax only capturing the first line? I can't remember if that as just a pflag update or something else.
@@ -166,7 +166,7 @@ func NewCmdNewApplication(name, baseName string, f *clientcmd.Factory, out, erro | |||
cmd.Flags().StringSliceVar(&config.Templates, "template", config.Templates, "Name of a stored template to use in the app.") | |||
cmd.Flags().StringSliceVarP(&config.TemplateFiles, "file", "f", config.TemplateFiles, "Path to a template file to use for the app.") | |||
cmd.MarkFlagFilename("file", "yaml", "yml", "json") | |||
cmd.Flags().StringSliceVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a list of key value pairs (e.g., -p FOO=BAR,BAR=FOO) to set/override parameter values in the template.") | |||
cmd.Flags().StringArrayVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a key-value pair (e.g., -p FOO=BAR) to set/override parameter value in the template.") |
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.
"to set/override a parameter value"
kcmdutil.CheckErr(err) | ||
}, | ||
} | ||
cmd.Flags().StringP("filename", "f", "", "Filename or URL to file to read a template") | ||
cmd.MarkFlagFilename("filename", "yaml", "yml", "json") | ||
cmd.Flags().StringSliceP("value", "v", nil, "Specify a list of key-value pairs (eg. -v FOO=BAR,BAR=FOO) to set/override parameter values") | ||
cmd.Flags().StringArrayP("value", "v", nil, "Specify a key-value pair (eg. -v FOO=BAR) to set/override parameter value in the template.") |
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.
"to set/override a parameter value"
@@ -166,7 +166,7 @@ func NewCmdNewApplication(name, baseName string, f *clientcmd.Factory, out, erro | |||
cmd.Flags().StringSliceVar(&config.Templates, "template", config.Templates, "Name of a stored template to use in the app.") | |||
cmd.Flags().StringSliceVarP(&config.TemplateFiles, "file", "f", config.TemplateFiles, "Path to a template file to use for the app.") | |||
cmd.MarkFlagFilename("file", "yaml", "yml", "json") | |||
cmd.Flags().StringSliceVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a list of key value pairs (e.g., -p FOO=BAR,BAR=FOO) to set/override parameter values in the template.") | |||
cmd.Flags().StringArrayVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a key-value pair (e.g., -p FOO=BAR) to set/override parameter value in the template.") | |||
cmd.Flags().StringSliceVar(&config.Groups, "group", config.Groups, "Indicate components that should be grouped together as <comp1>+<comp2>.") | |||
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.") |
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.
we should do the same thing for env (drop comma support, add a warning)
2ef8bd0
to
7618ef3
Compare
@bparees updated to handle |
@@ -139,7 +139,7 @@ func NewCmdUp(name, fullName string, f *osclientcmd.Factory, out io.Writer) *cob | |||
cmd.Flags().StringVar(&config.HostDataDir, "host-data-dir", "", "Directory on Docker host for OpenShift data. If not specified, etcd data will not be persisted on the host.") | |||
cmd.Flags().BoolVar(&config.PortForwarding, "forward-ports", config.PortForwarding, "Use Docker port-forwarding to communicate with origin container. Requires 'socat' locally.") | |||
cmd.Flags().IntVar(&config.ServerLogLevel, "server-loglevel", 0, "Log level for OpenShift server") | |||
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key value pairs of environment variables to set on OpenShift container") | |||
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key value pair of environment variable to set on OpenShift container") |
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.
"Specify a key value pair of environment variable"->"Specify a key value pair for an environment variable"
cmd.Flags().StringSliceVar(&config.Groups, "group", config.Groups, "Indicate components that should be grouped together as <comp1>+<comp2>.") | ||
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.") | ||
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair of environment variable to set into each container. This doesn't apply to objects created from a template, use parameters instead.") |
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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
@@ -128,7 +128,7 @@ func NewCmdNewBuild(name, baseName string, f *clientcmd.Factory, in io.Reader, o | |||
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated build artifacts.") | |||
cmd.Flags().StringVar(&config.To, "to", "", "Push built images to this image stream tag (or Docker image repository if --to-docker is set).") | |||
cmd.Flags().BoolVar(&config.OutputDocker, "to-docker", false, "Have the build output push to a Docker repository.") | |||
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key value pairs of environment variables to set into resulting image.") | |||
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key value pair of environment variable to set into resulting image.") |
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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
@@ -93,7 +93,7 @@ func NewCmdEnv(fullName string, f *clientcmd.Factory, in io.Reader, out, errout | |||
cmd.Flags().StringP("containers", "c", "*", "The names of containers in the selected pod templates to change - may use wildcards") | |||
cmd.Flags().StringP("from", "", "", "The name of a resource from which to inject enviroment variables") | |||
cmd.Flags().StringP("prefix", "", "", "Prefix to append to variable names") | |||
cmd.Flags().StringSliceVarP(&env, "env", "e", env, "Specify key value pairs of environment variables to set into each container.") | |||
cmd.Flags().StringArrayVarP(&env, "env", "e", env, "Specify a key value pair of environment variable to set into each container.") |
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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
@@ -90,7 +90,7 @@ func NewCmdStartBuild(fullName string, f *clientcmd.Factory, in io.Reader, out, | |||
}, | |||
} | |||
cmd.Flags().StringVar(&o.LogLevel, "build-loglevel", o.LogLevel, "Specify the log level for the build log output") | |||
cmd.Flags().StringSliceVarP(&o.Env, "env", "e", o.Env, "Specify key value pairs of environment variables to set for the build container.") | |||
cmd.Flags().StringArrayVarP(&o.Env, "env", "e", o.Env, "Specify a key value pair of environment variable to set for the build container.") |
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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
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.
Right, that sounds better. BTW some of the descriptions say key value pair while others have key-value pair, I suppose it would be nice to be consistent. Which one is correct?
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 like key-value
func WarnAboutCommaSeparation(errout io.Writer, values []string, flag string) { | ||
for _, value := range values { | ||
if strings.ContainsRune(value, ',') { | ||
fmt.Fprintf(errout, "warning: %s no longer accepts comma-separated list of values. %q will be treated as a single key-value pair.\n", flag, value) |
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.
s/list/lists/
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.
we should only warn if the value looks like "key1=value1,key2=value2". In other words, we have to see both a command and an equal after key1= for it to be a problem. There's nothing wrong with "key1=a,b,c"
@mfojtik you will need to review this also since it's changing oc set for deploymentconfigs. |
7618ef3
to
145dcb7
Compare
@bparees fixed the descriptions, changed the warning functions to match against |
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.
couple more test requests and then lgtm.
os::cmd::expect_success_and_not_text 'oc new-app ruby-helloworld-sample --param MYSQL_PASSWORD=com,ma -o yaml' 'no longer accepts comma-separated list' | ||
# check that warning is not printed when parameters/env are passed positionally | ||
os::cmd::expect_success_and_not_text 'oc new-app php PASS=one,two=three -o yaml' 'no longer accepts comma-separated list' | ||
os::cmd::expect_success_and_not_text 'oc new-app ruby-helloworld-sample MYSQL_PASSWORD=one,two=three -o yaml' 'no longer accepts comma-separated list' |
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.
these two tests should also confirm that the parameter/env is not split.
os::cmd::expect_success_and_text 'oc new-build --binary php --env X=Y,Z=W -o yaml' 'no longer accepts comma-separated list' | ||
os::cmd::expect_success_and_not_text 'oc new-build --binary php --env X=Y,Z,W -o yaml' 'no longer accepts comma-separated list' | ||
os::cmd::expect_success_and_not_text 'oc new-build --binary php --env X=Y -o yaml' 'no longer accepts comma-separated list' | ||
os::cmd::expect_success_and_not_text 'oc new-build --binary php X=Y,Z=W -o yaml' 'no longer accepts comma-separated list' |
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.
confirm this test does not split the env into two.
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' --value=required_param=a_b_c_d" 'no longer accepts comma-separated list' | ||
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' --value=required_param=a,b,c,d" 'no longer accepts comma-separated list' | ||
# warning is not printed for template values passed as positional arguments | ||
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' required_param=a,b=c,d" 'no longer accepts comma-separated list' |
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.
confirm argument is not split.
os::cmd::expect_success_and_text 'oc process ruby-helloworld-sample MYSQL_USER=myself MYSQL_PASSWORD=my,1%pass' '"myself"' | ||
os::cmd::expect_success_and_text 'oc process MYSQL_USER=myself MYSQL_PASSWORD=my,1%pass ruby-helloworld-sample' '"my,1%pass"' | ||
os::cmd::expect_success_and_text 'oc process ruby-helloworld-sample MYSQL_USER=myself MYSQL_PASSWORD=my,1%pa=s' '"myself"' | ||
os::cmd::expect_success_and_text 'oc process MYSQL_USER=myself MYSQL_PASSWORD=my,1%pa=s ruby-helloworld-sample' '"my,1%pa=s"' |
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.
looks like this covers at least one of the test suggestions i made above.
I wonder if cmd/templates.sh and cmd/process.sh should be combined into a single test script so we can do some de-duping.
Not for this PR though.
145dcb7
to
b39d554
Compare
b39d554
to
d3df274
Compare
Following assertion failed because
Pushed new version with the test removed. |
Flaked on #10988 |
Automatic merge from submit-queue Update github.com/spf13/pflag to latest version <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: This PR updates `github.com/spf13/pflag` to the latest version. * OpenShift needs pflag bump in order to use [`StringArray`](spf13/pflag#89), and * Latest revision contains couple of bugfixes that I'd like to have there, and * Kubernetes should have the same version, which is the reason for this PR **Which issue this PR fixes**: None, related to openshift/origin#11539. **Special notes for your reviewer**: `hack/verify-godeps.sh` fails with following output even though I haven't touched that package: https://gist.github.com/mmilata/3cb84b754f9b9e7ff371a7b6c5131b09 Am I using the wrong golang/godep version perhaps? Any hint what am I doing wrong? **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note NONE ```
[test] |
The test got stuck on
Should be reported as a flake? [test] again? |
report the test run as a flake in an issue (might be a new docker failure [test] On Mon, Oct 31, 2016 at 1:29 PM, OpenShift Bot [email protected]
|
Filed #11671 |
Flake #11406 |
[test] |
Evaluated for origin test up to d3df274 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10904/) (Base Commit: 76dc98f) |
@bparees, modified the tests as you suggested, PTAL |
lgtm [merge] |
Evaluated for origin merge up to d3df274 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10904/) (Base Commit: 16306a6) (Image: devenv-rhel7_5291) |
@smarterclayton you requested a public notification for this change in #10952 (comment) Where do I add a release note? I'm planning to send an email to users@ list as well. |
In openshift-docs (there should be a 3.4 release note list) On Thu, Nov 3, 2016 at 11:10 AM, Martin Milata [email protected]
|
Related to #10687, #10952.
TODO:
--env
parametersThe bump commit was created manually because I've been unable to make
godep restore
work for me. The bump is needed in order to have https://godoc.org/github.com/spf13/pflag#StringArray.