diff --git a/app/scripts/modules/kubernetes/cluster/configure/CommandBuilder.js b/app/scripts/modules/kubernetes/cluster/configure/CommandBuilder.js index eb903c0f2dd..38a3a81db74 100644 --- a/app/scripts/modules/kubernetes/cluster/configure/CommandBuilder.js +++ b/app/scripts/modules/kubernetes/cluster/configure/CommandBuilder.js @@ -137,8 +137,10 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv } function buildImageId(image) { - if (image.fromContext) { + if (image.fromFindImage) { return `${image.cluster} ${image.pattern}`; + } else if (image.fromBake) { + return `${image.repository} (Baked during execution)`; } else if (image.fromTrigger && !image.tag) { return `${image.registry}/${image.repository} (Tag resolved at runtime)`; } else { @@ -173,7 +175,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv return result; } - function findUpstreamImages(current, all, visited = {}) { + function findContextImages(current, all, visited = {}) { // This actually indicates a loop in the stage dependencies. if (visited[current.refId]) { return []; @@ -184,16 +186,25 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv if (current.type === 'findImage') { result.push({ fromContext: true, + fromFindImage: true, cluster: current.cluster, pattern: current.imageNamePattern, repository: current.name, stageId: current.refId }); + } else if (current.type === 'bake') { + result.push({ + fromContext: true, + fromBake: true, + repository: current.ami_name, + organization: current.organization, + stageId: current.refId + }); } current.requisiteStageRefIds.forEach(function(id) { let next = all.find((stage) => stage.refId === id); if (next) { - result = result.concat(findUpstreamImages(next, all, visited)); + result = result.concat(findContextImages(next, all, visited)); } }); @@ -216,7 +227,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv } function buildNewClusterCommandForPipeline(current, pipeline) { - let contextImages = findUpstreamImages(current, pipeline.stages) || []; + let contextImages = findContextImages(current, pipeline.stages) || []; contextImages = contextImages.concat(findTriggerImages(pipeline.triggers)); return { strategy: '', @@ -232,7 +243,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv function buildClusterCommandFromPipeline(app, originalCommand, current, pipeline) { let command = _.cloneDeep(originalCommand); - let contextImages = findUpstreamImages(current, pipeline.stages) || []; + let contextImages = findContextImages(current, pipeline.stages) || []; contextImages = contextImages.concat(findTriggerImages(pipeline.triggers)); command.containers = reconcileUpstreamImages(command.containers, contextImages); command.containers.map((container) => {