-
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
add --ignore-unknown-parameters flag to new-app and process #15230
Conversation
[test] |
@bparees don't we have 'required' parameter for this? |
no that's different. required means "you must supply a non-empty string value for this parameter". this PR is to allow users to do something like: and not get an error. Your confusion on the subject means the flag name is probably not great since in this case we mean "invalid" as in "does not exist", not "invalid" as in "not a valid value for the parameter". @matthyx can we try a different flag name? maybe "--skip-absent-parameters"? |
[test] |
@openshift/cli-review |
@bparees I have the change with the new parameter name... should I push now or I wait until I have tests ready as well? |
@matthyx might as well add the tests first. |
Some ideas
|
|
@bparees done with tests added and squashed |
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.
nit on the help text, otherwise lgtm.
pkg/cmd/cli/cmd/newapp.go
Outdated
@@ -237,6 +237,7 @@ func NewCmdNewApplication(name, baseName string, f *clientcmd.Factory, in io.Rea | |||
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated application artifacts") | |||
cmd.Flags().Var(&config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source).") | |||
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this application.") | |||
cmd.Flags().BoolVar(&config.IgnoreUnknownParameters, "ignore-unknown-parameters", false, "If true, will not stop processing the template when a parameter is not valid.") |
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.
help text should be "If true, will not stop processing if a provided parameter does not exist in the template."
pkg/cmd/cli/cmd/process.go
Outdated
@@ -92,6 +92,7 @@ func NewCmdProcess(fullName string, f *clientcmd.Factory, in io.Reader, out, err | |||
cmd.Flags().StringArrayVarP(params, "param", "p", nil, "Specify a key-value pair (eg. -p FOO=BAR) to set/override a parameter value in the template.") | |||
cmd.Flags().StringArray("param-file", []string{}, "File containing template parameter values to set/override in the template.") | |||
cmd.MarkFlagFilename("param-file") | |||
cmd.Flags().Bool("ignore-unknown-parameters", false, "If true, will not stop processing the template when a parameter is not valid.") |
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.
same help text change here.
[test] |
Evaluated for origin test up to e22ac23 |
@bparees I did the change and squashed... it seems github would have preferred I did differently :-/ |
lgtm, will merge once the 3.6 branch is cut. |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/3215/) (Base Commit: 6c3acd2) (PR Branch Commit: e22ac23) |
[merge][severity:lowrisk] |
thanks @matthyx! |
[merge] |
Evaluated for origin merge up to 109e55a |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1314/) (Base Commit: 3bb18b6) (PR Branch Commit: 109e55a) (Extended Tests: lowrisk) (Image: devenv-rhel7_6451) |
Origin Action Required: Please contact #openshift-dev to have this pull request manually reviewed and tested |
In which version is this fixed ? I am using OCP 3.5 and still able to reproduce thos error ? |
3.5 is pretty old (3.9 is current and 3.10 is about to release). the fix appears to be in v3.7 |
'oc process' should be able to ignore invalid parameter names via a flag
fixes #12909