Skip to content

Commit

Permalink
feat(provider/oraclebmcs): Add destroy server group stage
Browse files Browse the repository at this point in the history
  • Loading branch information
owainlewis authored and anotherchrisberry committed May 19, 2017
1 parent a050ddb commit b0d538d
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 1 deletion.
41 changes: 40 additions & 1 deletion app/scripts/modules/oracle/helpContents/oracleHelpContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,46 @@ module(ORACLE_HELP_CONTENTS_REGISTRY, [HELP_CONTENTS_REGISTRY])
{
key: 'oraclebmcs.serverGroup.detail',
value: '(Optional) <b>Detail</b> is a naming component to help distinguish specifics of the server group.'
}
},
{
key: 'oraclebmcs.pipeline.config.bake.baseOsOption',
value: '<p>The base operating system from which the image will be created.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.package',
value: '<p>The name of the package you want installed (without any version identifiers).</p>' +
'<p>For example: <i>curl</i>.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.upgrade',
value: '<p>Perform a package manager upgrade before proceeding with the package installation.</p>' +
'<p>For example: <i>yum update</i>.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.regions',
value: '<p>The region in which the new image will be created.</p>' +
'<p>NB: <i>Currently baked images are restricted to a single region</i>.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.user',
value: '<p>The name of Oracle BMCS <i>user</i> that will be used during the baking process.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.account_name',
value: '<p>The name of Oracle BMCS <i>account</i> that will be used during the baking process.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.network',
value: '<p>The name of Oracle BMCS <i>network</i> that will be used during the baking process.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.availability_domain',
value: '<p>The Oracle BMCS <i>availability domain</i> that will be used during the baking process.</p>'
},
{
key: 'oraclebmcs.pipeline.config.bake.subnet_ocid',
value: '<p>The the Oracle BMCS <i>subnet</i> that will be used during the baking process.</p>'
},
];

helpContents.forEach((entry) => helpContentsRegistry.register(entry.key, entry.value));
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/modules/oracle/oraclebmcs.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ templates.keys().forEach(function(key) {
module.exports = angular.module('spinnaker.oraclebmcs', [
CLOUD_PROVIDER_REGISTRY,
ORACLE_HELP_CONTENTS_REGISTRY,
//Cache
require('./cache/cacheConfigurer.service.js'),
// Pipeline
require('./pipeline/stages/destroyAsg/destroyAsgStage.js'),
// Server Groups
require('./serverGroup/serverGroup.transformer.js'),
require('./serverGroup/configure/serverGroup.configure.module.js'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div ng-controller="oraclebmcsDestroyAsgStageCtrl 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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';

const angular = require('angular');

import {
StageConstants,
PipelineTemplates
} from '@spinnaker/core';

module.exports = angular.module('spinnaker.oraclebmcs.pipeline.stage.destroyAsgStage', [])
.config(function(pipelineConfigProvider) {
pipelineConfigProvider.registerStage({
provides: 'destroyServerGroup',
cloudProvider: 'oraclebmcs',
templateUrl: require('./destroyAsgStage.html'),
executionDetailsUrl: PipelineTemplates.destroyAsgExecutionDetails,
executionStepLabelUrl: require('./destroyAsgStepLabel.html'),
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('oraclebmcsDestroyAsgStageCtrl', function($scope, accountService) {

let stage = $scope.stage;
let provider = 'oraclebmcs';

$scope.targets = StageConstants.TARGET_LIST;
stage.regions = stage.regions || [];
stage.cloudProvider = provider;
$scope.state = {
accounts: false,
regionsLoaded: false
};

init();

function init () {
accountService.listAccounts(provider).then(accounts => {
$scope.accounts = accounts;
$scope.state.accounts = true;
});

if (!stage.credentials && $scope.application.defaultCredentials.oraclebmcs) {
stage.credentials = $scope.application.defaultCredentials.oraclebmcs;
}

if (!stage.regions.length && $scope.application.defaultRegions.oraclebmcs) {
stage.regions.push($scope.application.defaultRegions.oraclebmcs);
}

if (!stage.target) {
stage.target = $scope.targets[0].val;
}
}
});
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>

0 comments on commit b0d538d

Please sign in to comment.