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): Allow moniker field to pass through to StageData and TargetServerGroups #1678

Merged
merged 3 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -20,6 +20,7 @@ import groovy.transform.InheritConstructors
import groovy.transform.ToString
import groovy.util.logging.Slf4j
import com.netflix.frigga.Names
import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.kato.pipeline.support.StageData
import com.netflix.spinnaker.orca.pipeline.model.Stage

Expand Down Expand Up @@ -195,6 +196,7 @@ class TargetServerGroup {
// TODO(ttomsu): This feels dirty - consider structuring to enable an 'exact' Target that just specifies the exact
// server group name to fetch?
String serverGroupName
Moniker moniker

// Alternatively to asgName, the combination of target and cluster can be used.
Target target
Expand All @@ -205,11 +207,11 @@ class TargetServerGroup {
String cloudProvider = "aws"

String getApp() {
Names.parseName(serverGroupName ?: cluster)?.app
moniker?.app ?: Names.parseName(serverGroupName ?: cluster)?.app
}

String getCluster() {
cluster ?: Names.parseName(serverGroupName)?.cluster
moniker?.cluster ?: cluster ?: Names.parseName(serverGroupName)?.cluster
}

static Params fromStage(Stage stage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.netflix.spinnaker.orca.kato.pipeline.support

import com.netflix.frigga.autoscaling.AutoScalingGroupNameBuilder
import com.netflix.spinnaker.moniker.Moniker

class StageData {
String strategy
Expand All @@ -27,6 +28,7 @@ class StageData {
String freeFormDetails
String application
String stack
Moniker moniker
@Deprecated String providerType = "aws"
String cloudProvider = "aws"
boolean scaleDown
Expand All @@ -38,11 +40,15 @@ class StageData {
long delayBeforeDisableSec

String getCluster() {
def builder = new AutoScalingGroupNameBuilder()
builder.appName = application
builder.stack = stack
builder.detail = freeFormDetails
return builder.buildGroupName()
if (moniker?.cluster) {
return moniker.cluster
} else {
def builder = new AutoScalingGroupNameBuilder()
builder.appName = application
builder.stack = stack
builder.detail = freeFormDetails
return builder.buildGroupName()
}
}

String getAccount() {
Expand Down