From e7f6d906f52adb08bafc2261e2ef1c3aea0ae865 Mon Sep 17 00:00:00 2001 From: Samuel Padgett Date: Tue, 26 Sep 2017 08:03:49 -0400 Subject: [PATCH] Bug 1495460 - Fix build config source namespace Correctly set the build config source image namespace when adding a builder using advanced options. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1495460 --- app/scripts/services/applicationGenerator.js | 7 +++---- dist/scripts/scripts.js | 5 +++-- test/spec/services/applicationGeneratorSpec.js | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/scripts/services/applicationGenerator.js b/app/scripts/services/applicationGenerator.js index 6e1fb21d4e..b5b96d51ce 100644 --- a/app/scripts/services/applicationGenerator.js +++ b/app/scripts/services/applicationGenerator.js @@ -351,7 +351,8 @@ angular.module("openshiftConsole") sourceStrategy: { from: { kind: "ImageStreamTag", - name: input.imageName + ":" + input.imageTag + name: input.imageName + ":" + input.imageTag, + namespace: input.namespace }, env: env } @@ -359,9 +360,7 @@ angular.module("openshiftConsole") triggers: triggers } }; - if(input.namespace) { - bc.spec.strategy.namespace = input.namespace; - } + if (_.get(input, 'buildConfig.secrets.gitSecret[0].name')) { bc.spec.source.sourceSecret = _.head(input.buildConfig.secrets.gitSecret); } diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 39ea576fa0..7314f386ba 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -1496,7 +1496,8 @@ type: "Source", sourceStrategy: { from: { kind: "ImageStreamTag", -name: e.imageName + ":" + e.imageTag +name: e.imageName + ":" + e.imageTag, +namespace: e.namespace }, env: n } @@ -1504,7 +1505,7 @@ env: n triggers: a } }; -return e.namespace && (l.spec.strategy.namespace = e.namespace), _.get(e, "buildConfig.secrets.gitSecret[0].name") && (l.spec.source.sourceSecret = _.head(e.buildConfig.secrets.gitSecret)), e.buildConfig.contextDir && (l.spec.source.contextDir = e.buildConfig.contextDir), l; +return _.get(e, "buildConfig.secrets.gitSecret[0].name") && (l.spec.source.sourceSecret = _.head(e.buildConfig.secrets.gitSecret)), e.buildConfig.contextDir && (l.spec.source.contextDir = e.buildConfig.contextDir), l; }, o._generateImageStream = function(e) { return { apiVersion: "v1", diff --git a/test/spec/services/applicationGeneratorSpec.js b/test/spec/services/applicationGeneratorSpec.js index 88e323c991..13fae1d1b2 100644 --- a/test/spec/services/applicationGeneratorSpec.js +++ b/test/spec/services/applicationGeneratorSpec.js @@ -15,6 +15,7 @@ describe("ApplicationGenerator", function(){ inputTemplate = { name: "ruby-hello-world", + namespace: "openshift", routing: { include: true, targetPort: { @@ -288,7 +289,8 @@ describe("ApplicationGenerator", function(){ "sourceStrategy" : { "from": { "kind": "ImageStreamTag", - "name": "origin-ruby-sample:latest" + "name": "origin-ruby-sample:latest", + "namespace": "openshift" }, "env": [{ "name": "BUILD_ENV_1",