Skip to content

Commit

Permalink
fix(titus/deploy): Stop clobbering imageId if it is provided in the c…
Browse files Browse the repository at this point in the history
…onfig. Fixes SPIN-3219.
  • Loading branch information
Justin Reynolds authored and tomaslin committed Mar 16, 2018
1 parent 5e5cd3c commit c0cb51b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 6 additions & 1 deletion serverGroup/configure/ServerGroupCommandBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = angular.module('spinnaker.titus.serverGroupCommandBuilder.servi
mode: defaults.mode || 'create',
},
securityGroups: [],
imageId: defaults.imageId,
};

return $q.when(command);
Expand Down Expand Up @@ -142,7 +143,11 @@ module.exports = angular.module('spinnaker.titus.serverGroupCommandBuilder.servi
function buildServerGroupCommandFromPipeline(application, originalCluster) {

var pipelineCluster = _.cloneDeep(originalCluster);
var commandOptions = {account: pipelineCluster.account, region: pipelineCluster.region};
var commandOptions = {
account: pipelineCluster.account,
imageId: pipelineCluster.imageId,
region: pipelineCluster.region,
};
var asyncLoader = $q.all({command: buildNewServerGroupCommand(application, commandOptions)});

return asyncLoader.then(function (asyncData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const angular = require('angular');

import { ACCOUNT_SERVICE } from '@spinnaker/core';
import _ from 'lodash';

module.exports = angular.module('spinnaker.serverGroup.configure.titus.basicSettingsSelector', [
ACCOUNT_SERVICE
Expand Down Expand Up @@ -41,12 +42,15 @@ module.exports = angular.module('spinnaker.serverGroup.configure.titus.basicSett
return field && !field.includes('${');
};

function updateImageId() {
if ($scope.command.repository && $scope.command.tag) {
$scope.command.imageId = `${$scope.command.repository}:${$scope.command.tag}`;
}
else {
delete $scope.command.imageId;
function updateImageId(oldValues, newValues) {
// Make sure one of the watched fields was actually changed before updating imageId
if (!_.isEqual(oldValues, newValues)) {
if ($scope.command.repository && $scope.command.tag) {
$scope.command.imageId = `${$scope.command.repository}:${$scope.command.tag}`;
}
else {
delete $scope.command.imageId;
}
}
}

Expand Down

0 comments on commit c0cb51b

Please sign in to comment.