Skip to content

Commit

Permalink
feat(moniker) - adding monikers to the deploy stage (#4268)
Browse files Browse the repository at this point in the history
  • Loading branch information
imosquera authored and anotherchrisberry committed Oct 16, 2017
1 parent 37af51f commit 963e3f0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = angular.module('spinnaker.amazon.serverGroupCommandBuilder.serv
var useAmiBlockDeviceMappings = applicationAwsSettings.useAmiBlockDeviceMappings || false;

var command = {
application: application.name,
application: application,
credentials: defaultCredentials,
region: defaultRegion,
strategy: '',
Expand Down Expand Up @@ -189,7 +189,7 @@ module.exports = angular.module('spinnaker.amazon.serverGroupCommandBuilder.serv
var useAmiBlockDeviceMappings = applicationAwsSettings.useAmiBlockDeviceMappings || false;

var command = {
application: application.name,
application: application,
strategy: '',
stack: serverGroupName.stack,
freeFormDetails: serverGroupName.freeFormDetails,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { module, IPromise, IQService } from 'angular';
import { chain, clone, cloneDeep, extend, find, flatten, has, intersection, keys, map, some, xor } from 'lodash';
import { chain, clone, cloneDeep, extend, find, flatten, has, intersection, isNil, keys, map, some, xor } from 'lodash';

import {
ACCOUNT_SERVICE,
Expand Down Expand Up @@ -29,6 +29,8 @@ import {

import { IAmazonLoadBalancer, IKeyPair } from 'amazon/domain';
import { KEY_PAIRS_READ_SERVICE, KeyPairsReader } from 'amazon/keyPairs/keyPairs.read.service';
import { IMoniker } from 'core/naming/IMoniker';
import { NamingService } from 'core/naming/naming.service';

export type IBlockDeviceMappingSource = 'source' | 'ami' | 'default';

Expand Down Expand Up @@ -66,6 +68,7 @@ export interface IAmazonServerGroupCommand extends IServerGroupCommand {
getBlockDeviceMappingsSource: () => IBlockDeviceMappingSource;
selectBlockDeviceMappingsSource: (selection: string) => void;
usePreferredZonesChanged: () => IAmazonServerGroupCommandResult;
clusterChanged: () => void;
}

export class AwsServerGroupConfigurationService {
Expand All @@ -82,6 +85,7 @@ export class AwsServerGroupConfigurationService {
private subnetReader: SubnetReader,
private keyPairsReader: KeyPairsReader,
private loadBalancerReader: LoadBalancerReader,
private namingService: NamingService,
private serverGroupCommandRegistry: ServerGroupCommandRegistry,
private autoScalingProcessService: any) {
'ngInject';
Expand Down Expand Up @@ -567,6 +571,17 @@ export class AwsServerGroupConfigurationService {
return result;
};

command.clusterChanged = (): void => {
const appName = isNil(command.application) ? undefined : command.application.name;
const moniker: IMoniker = {
app: appName,
stack: command.stack,
detail: command.freeFormDetails,
cluster: this.namingService.getClusterName(appName, command.stack, command.freeFormDetails)
};
command.moniker = moniker;
};

command.credentialsChanged = (): IServerGroupCommandResult => {
const result: IAmazonServerGroupCommandResult = { dirty: {} };
const backingData = command.backingData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {module} from 'angular';

import { Application } from 'core/application/application.model';
import { IMoniker } from 'core/naming/IMoniker';
import { ILoadBalancer, ISecurityGroup, ISubnet, IEntityTags } from 'core/domain';
import { ICapacity } from 'core/serverGroup/serverGroupWriter.service';
import { IDeploymentStrategy } from 'core/deploymentStrategy';
Expand Down Expand Up @@ -95,6 +96,7 @@ export interface IServerGroupCommand extends IServerGroupCommandResult {
asgName: string;
};
stack?: string;
moniker?: IMoniker;
strategy: string;
subnetType: string;
suspendedProcesses: string[];
Expand Down

0 comments on commit 963e3f0

Please sign in to comment.