You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.")
168
+
cmd.Flags().StringArrayVar(&config.TemplateParameterFiles, "param-file", config.TemplateParameterFiles, "File containing parameter values to set/override in the template.")
169
+
cmd.MarkFlagFilename("param-file")
171
170
cmd.Flags().StringSliceVar(&config.Groups, "group", config.Groups, "Indicate components that should be grouped together as <comp1>+<comp2>.")
172
171
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair for an environment variable to set into each container.")
172
+
cmd.Flags().StringArrayVar(&config.EnvironmentFiles, "env-file", config.EnvironmentFiles, "File containing key-value pairs of environment variables to set into each container.")
173
+
cmd.MarkFlagFilename("env-file")
173
174
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated application artifacts")
174
175
cmd.Flags().Var(&config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source).")
175
176
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this application.")
Copy file name to clipboardexpand all lines: pkg/cmd/cli/cmd/newbuild.go
+5
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,7 @@ type NewBuildOptions struct {
90
90
CommandPathstring
91
91
CommandNamestring
92
92
93
+
In io.Reader
93
94
Out, ErrOut io.Writer
94
95
Outputstring
95
96
PrintObjectfunc(obj runtime.Object) error
@@ -129,6 +130,8 @@ func NewCmdNewBuild(name, baseName string, f *clientcmd.Factory, in io.Reader, o
129
130
cmd.Flags().StringVar(&config.To, "to", "", "Push built images to this image stream tag (or Docker image repository if --to-docker is set).")
130
131
cmd.Flags().BoolVar(&config.OutputDocker, "to-docker", false, "Have the build output push to a Docker repository.")
131
132
cmd.Flags().StringArrayVarP(&config.Environment, "env", "e", config.Environment, "Specify a key-value pair for an environment variable to set into resulting image.")
133
+
cmd.Flags().StringArrayVar(&config.EnvironmentFiles, "env-file", config.EnvironmentFiles, "File containing key-value pairs of environment variables to set into each container.")
134
+
cmd.MarkFlagFilename("env-file")
132
135
cmd.Flags().Var(&config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source).")
133
136
cmd.Flags().StringVarP(&config.Dockerfile, "dockerfile", "D", "", "Specify the contents of a Dockerfile to build directly, implies --strategy=docker. Pass '-' to read from STDIN.")
134
137
cmd.Flags().BoolVar(&config.BinaryBuild, "binary", false, "Instead of expecting a source URL, set the build to expect binary contents. Will disable triggers.")
@@ -148,11 +151,13 @@ func NewCmdNewBuild(name, baseName string, f *clientcmd.Factory, in io.Reader, o
148
151
149
152
// Complete sets any default behavior for the command
os::cmd::expect_success_and_text 'oc process ruby-helloworld-sample MYSQL_USER=myself MYSQL_PASSWORD=my,1%pa=s''"myself"'
48
51
os::cmd::expect_success_and_text 'oc process MYSQL_USER=myself MYSQL_PASSWORD=my,1%pa=s ruby-helloworld-sample''"my,1%pa=s"'
49
52
os::cmd::expect_success_and_text 'oc process ruby-helloworld-sample -p MYSQL_USER=myself -p MYSQL_PASSWORD=my,1%pa=s''"myself"'
50
53
os::cmd::expect_success_and_text 'oc process -p MYSQL_USER=myself -p MYSQL_PASSWORD=my,1%pa=s ruby-helloworld-sample''"my,1%pa=s"'
54
+
# Argument values can be read from file
55
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}'"'"root"'
56
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}'"'"adminpass"'
57
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}'"'"redispass"'
58
+
# Argument values can be read from stdin
59
+
os::cmd::expect_success_and_text "cat '${guestbook_params}' | oc process -f '${guestbook_template}' --param-file=-"'"root"'
60
+
os::cmd::expect_success_and_text "cat '${guestbook_params}' | oc process -f '${guestbook_template}' --param-file=-"'"adminpass"'
61
+
os::cmd::expect_success_and_text "cat '${guestbook_params}' | oc process -f '${guestbook_template}' --param-file=-"'"redispass"'
62
+
# Argument values from command line have precedence over those from file
63
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}' -p ADMIN_USERNAME=myuser"'ignoring value from file'
64
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}' -p ADMIN_USERNAME=myuser"'"myuser"'
65
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}' -p ADMIN_PASSWORD=mypassword"'"mypassword"'
66
+
os::cmd::expect_success_and_text "oc process -f '${guestbook_template}' --param-file='${guestbook_params}' -p REDIS_PASSWORD=rrr"'"rrr"'
67
+
# Set template parameters from parameter file with multiline values
68
+
os::cmd::expect_success_and_text "oc process -f test/testdata/template_required_params.yaml --param-file=test/testdata/template_required_params.env -o yaml"'first$'
os::cmd::expect_failure_and_text 'oc process name1 name2''template name must be specified only once'
121
+
# fail to pass a filename or template by name
122
+
os::cmd::expect_failure_and_text 'oc process''Must pass a filename or name of stored template'
123
+
# can't ask for parameters and try process the template (include tests for deprecated -v/--value)
124
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --value=someval''\-\-parameters flag does not process the template, can.t be used with \-\-value'
125
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters -v someval''\-\-parameters flag does not process the template, can.t be used with \-\-value'
126
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --param=someval''\-\-parameters flag does not process the template, can.t be used with \-\-param'
127
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters -p someval''\-\-parameters flag does not process the template, can.t be used with \-\-param'
128
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --labels=someval''\-\-parameters flag does not process the template, can.t be used with \-\-labels'
129
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters -l someval''\-\-parameters flag does not process the template, can.t be used with \-\-labels'
130
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --output=someval''\-\-parameters flag does not process the template, can.t be used with \-\-output'
131
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters -o someval''\-\-parameters flag does not process the template, can.t be used with \-\-output'
132
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --output-version=someval''\-\-parameters flag does not process the template, can.t be used with \-\-output-version'
133
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --raw''\-\-parameters flag does not process the template, can.t be used with \-\-raw'
134
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters --template=someval''\-\-parameters flag does not process the template, can.t be used with \-\-template'
135
+
os::cmd::expect_failure_and_text 'oc process template-name --parameters -t someval''\-\-parameters flag does not process the template, can.t be used with \-\-template'
136
+
# providing a value more than once should fail (include tests for deprecated -v/--value)
137
+
os::cmd::expect_failure_and_text 'oc process template-name key=value key=value''provided more than once: key'
138
+
os::cmd::expect_failure_and_text 'oc process template-name --value=key=value --value=key=value''provided more than once: key'
139
+
os::cmd::expect_failure_and_text 'oc process template-name --param=key=value --param=key=value''provided more than once: key'
140
+
os::cmd::expect_failure_and_text 'oc process template-name key=value --value=key=value''provided more than once: key'
141
+
os::cmd::expect_failure_and_text 'oc process template-name key=value --param=key=value''provided more than once: key'
142
+
os::cmd::expect_failure_and_text 'oc process template-name key=value other=foo --value=key=value --value=other=baz''provided more than once: key, other'
143
+
os::cmd::expect_failure_and_text 'oc process template-name key=value other=foo --param=key=value --param=other=baz''provided more than once: key, other'
os::cmd::expect_success_and_text 'oc get user someval -o jsonpath={.Name}''someval'
160
+
os::cmd::expect_success_and_text 'oc get user someval=moreval -o jsonpath={.Name}''someval=moreval'
161
+
os::cmd::expect_success_and_text 'oc get user someval=moreval2 -o jsonpath={.Name}''someval=moreval2'
162
+
os::cmd::expect_success_and_text 'oc get user someval=moreval3 -o jsonpath={.Name}''someval=moreval3'
163
+
# providing a value not in the template should fail
164
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --value=required_param=someval --value=other_param=otherval"'unknown parameter name "other_param"'
165
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --param=required_param=someval --param=other_param=otherval"'unknown parameter name "other_param"'
166
+
# failure on values fails the entire call
167
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --value=required_param=someval --value=optional_param"'invalid parameter assignment in'
168
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --param=required_param=someval --param=optional_param"'invalid parameter assignment in'
169
+
# failure on labels fails the entire call
170
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --value=required_param=someval --labels======"'error parsing labels'
171
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --param=required_param=someval --labels======"'error parsing labels'
172
+
# values are not split on commas, required parameter is not recognized
173
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --value=optional_param=a,required_param=b"'parameter required_param is required and must be specified'
174
+
os::cmd::expect_failure_and_text "oc process -f '${required_params}' --param=optional_param=a,required_param=b"'parameter required_param is required and must be specified'
175
+
# warning is printed iff --value/--param looks like two k-v pairs separated by comma
176
+
os::cmd::expect_success_and_text "oc process -f '${required_params}' --value=required_param=a,b=c,d"'no longer accepts comma-separated list'
177
+
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'
178
+
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'
179
+
os::cmd::expect_success_and_text "oc process -f '${required_params}' --param=required_param=a,b=c,d"'no longer accepts comma-separated list'
180
+
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' --param=required_param=a_b_c_d"'no longer accepts comma-separated list'
181
+
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' --param=required_param=a,b,c,d"'no longer accepts comma-separated list'
182
+
# warning is not printed for template values passed as positional arguments
183
+
os::cmd::expect_success_and_not_text "oc process -f '${required_params}' required_param=a,b=c,d"'no longer accepts comma-separated list'
184
+
# set template parameter to contents of file
185
+
os::cmd::expect_success_and_text "oc process -f '${required_params}' --value=required_param='`cat ${OS_ROOT}/test/testdata/multiline.txt`'"'also,with=commas'
186
+
os::cmd::expect_success_and_text "oc process -f '${required_params}' --param=required_param='`cat ${OS_ROOT}/test/testdata/multiline.txt`'"'also,with=commas'
0 commit comments