Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(moniker) - adding monikers to the deploy stage #4268

Merged
merged 1 commit into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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