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 |
pkg/cmd/cli/cmd/newapp.go
Outdated
| 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.
"to set/override a parameter value"
pkg/cmd/cli/cmd/process.go
Outdated
| 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.
"to set/override a parameter value"
pkg/cmd/cli/cmd/newapp.go
Outdated
| 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.
we should do the same thing for env (drop comma support, add a warning)
2ef8bd0 to
7618ef3
Compare
|
@bparees updated to handle |
pkg/bootstrap/docker/up.go
Outdated
| 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.
"Specify a key value pair of environment variable"->"Specify a key value pair for an environment variable"
pkg/cmd/cli/cmd/newapp.go
Outdated
| cmd.Flags().StringArrayVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a key-value pair (e.g., -p FOO=BAR) to set/override a 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.") | ||
| 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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
pkg/cmd/cli/cmd/newbuild.go
Outdated
| 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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
pkg/cmd/cli/cmd/set/env.go
Outdated
| 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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
pkg/cmd/cli/cmd/startbuild.go
Outdated
| } | ||
| 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.
Specify a key value pair of environment variable -> Specify a key value pair for an environment variable
There was a problem hiding this comment.
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?
pkg/cmd/util/cmd.go
Outdated
| 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.
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 |
bparees
left a comment
There was a problem hiding this comment.
couple more test requests and then lgtm.
test/cmd/newapp.sh
Outdated
| 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.
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.
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.
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.
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 notifications@github.com
|
|
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 notifications@github.com
|
Related to #10687, #10952.
TODO:
--envparametersThe bump commit was created manually because I've been unable to make
godep restorework for me. The bump is needed in order to have https://godoc.org/github.com/spf13/pflag#StringArray.