Skip to content

Commit 071f2c1

Browse files
author
OpenShift Bot
authored
Merge pull request #15019 from coreydaley/github_14960_context_dir_not_working_on_templates
Merged by openshift-bot
2 parents 72b9f3d + 0a4fc41 commit 071f2c1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/generate/app/cmd/newapp.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ func (c *AppConfig) buildTemplates(components app.ComponentReferences, parameter
473473
tpl := ref.Input().ResolvedMatch.Template
474474

475475
glog.V(4).Infof("processing template %s/%s", c.OriginNamespace, tpl.Name)
476+
if len(c.ContextDir) > 0 {
477+
return "", nil, fmt.Errorf("--context-dir is not supported when using a template")
478+
}
476479
result, err := TransformTemplate(tpl, c.OSClient, c.OriginNamespace, parameters)
477480
if err != nil {
478481
return name, nil, err

test/cmd/newapp.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ os::cmd::expect_success_and_text 'oc new-app ruby-helloworld-sample --param MYSQ
9595
os::cmd::expect_success_and_text 'oc new-app -e FOO=BAR -f examples/jenkins/jenkins-ephemeral-template.json -o jsonpath="{.items[?(@.kind==\"DeploymentConfig\")].spec.template.spec.containers[0].env[?(@.name==\"FOO\")].value}" ' '^BAR$'
9696
os::cmd::expect_success_and_text 'oc new-app -e OPENSHIFT_ENABLE_OAUTH=false -f examples/jenkins/jenkins-ephemeral-template.json -o jsonpath="{.items[?(@.kind==\"DeploymentConfig\")].spec.template.spec.containers[0].env[?(@.name==\"OPENSHIFT_ENABLE_OAUTH\")].value}" ' 'false'
9797

98+
# check that an error is produced when using --context-dir with a template
99+
os::cmd::expect_failure_and_text 'oc new-app -f examples/sample-app/application-template-stibuild.json --context-dir=example' '\-\-context-dir is not supported when using a template'
100+
98101
# check that values are not split on commas
99102
os::cmd::expect_success_and_text 'oc new-app ruby-helloworld-sample --param MYSQL_DATABASE=hello,MYSQL_USER=fail -o yaml' 'value: hello,MYSQL_USER=fail'
100103
# check that warning is printed when --param PARAM1=VAL1,PARAM2=VAL2 is used

0 commit comments

Comments
 (0)