Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/ecs): Added DestroyAsg pipeline stage (#4399)
* feat(provider/ecs): Added DestroyAsg pipeline stage * Removed executionDetailsUrl property * removed unused import
- Loading branch information
1 parent
884e7ac
commit 3aab921
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/scripts/modules/ecs/pipeline/stages/destroyAsg/destroyAsgStage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div ng-controller="ecsDestroyAsgStageCtrl as destroyAsgStageCtrl" class="form-horizontal"> | ||
<div ng-if="!pipeline.strategy"> | ||
<account-region-cluster-selector | ||
application="application" | ||
component="stage" | ||
accounts="accounts" > | ||
</account-region-cluster-selector> | ||
</div> | ||
<stage-config-field label="Target"> | ||
<target-select model="stage" options="targets"></target-select> | ||
</stage-config-field> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
app/scripts/modules/ecs/pipeline/stages/destroyAsg/destroyAsgStepLabel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span class="task-label"> | ||
Destroy Server Group: | ||
{{step.context.serverGroupName}} | ||
({{step.context.region}}) | ||
</span> |
61 changes: 61 additions & 0 deletions
61
app/scripts/modules/ecs/pipeline/stages/destroyAsg/ecsDestroyAsgStage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict'; | ||
|
||
const angular = require('angular'); | ||
|
||
import { StageConstants } from '@spinnaker/core'; | ||
|
||
module.exports = angular.module('spinnaker.ecs.pipeline.stage.ecs.destroyAsgStage', []) | ||
.config(function(pipelineConfigProvider) { | ||
pipelineConfigProvider.registerStage({ | ||
provides: 'destroyServerGroup', | ||
alias: 'destroyAsg', | ||
cloudProvider: 'ecs', | ||
templateUrl: require('./destroyAsgStage.html'), | ||
executionStepLabelUrl: require('./destroyAsgStepLabel.html'), | ||
accountExtractor: (stage) => [stage.context.credentials], | ||
configAccountExtractor: (stage) => [stage.credentials], | ||
validators: [ | ||
{ | ||
type: 'targetImpedance', | ||
message: 'This pipeline will attempt to destroy a server group without deploying a new version into the same cluster.' | ||
}, | ||
{ type: 'requiredField', fieldName: 'cluster' }, | ||
{ type: 'requiredField', fieldName: 'target', }, | ||
{ type: 'requiredField', fieldName: 'regions', }, | ||
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account'}, | ||
], | ||
}); | ||
}).controller('ecsDestroyAsgStageCtrl', function($scope, accountService) { | ||
|
||
let stage = $scope.stage; | ||
|
||
$scope.state = { | ||
accounts: false, | ||
regionsLoaded: false | ||
}; | ||
|
||
accountService.listAccounts('ecs').then(function (accounts) { | ||
$scope.accounts = accounts; | ||
$scope.state.accounts = true; | ||
}); | ||
|
||
$scope.regions = ['us-east-1', 'us-west-1', 'eu-west-1', 'us-west-2']; | ||
|
||
$scope.targets = StageConstants.TARGET_LIST; | ||
|
||
stage.regions = stage.regions || []; | ||
stage.cloudProvider = 'ecs'; | ||
|
||
if (!stage.credentials && $scope.application.defaultCredentials.ecs) { | ||
stage.credentials = $scope.application.defaultCredentials.ecs; | ||
} | ||
if (!stage.regions.length && $scope.application.defaultRegions.ecs) { | ||
stage.regions.push($scope.application.defaultRegions.ecs); | ||
} | ||
|
||
if (!stage.target) { | ||
stage.target = $scope.targets[0].val; | ||
} | ||
|
||
}); | ||
|