diff --git a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/servergroup/support/TargetServerGroup.groovy b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/servergroup/support/TargetServerGroup.groovy index b5e2cba7c4..b462cf07d7 100644 --- a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/servergroup/support/TargetServerGroup.groovy +++ b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/clouddriver/pipeline/servergroup/support/TargetServerGroup.groovy @@ -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 @@ -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 @@ -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) { diff --git a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/StageData.groovy b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/StageData.groovy index ef9e458d25..8aa7153878 100644 --- a/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/StageData.groovy +++ b/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/StageData.groovy @@ -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 @@ -27,6 +28,7 @@ class StageData { String freeFormDetails String application String stack + Moniker moniker @Deprecated String providerType = "aws" String cloudProvider = "aws" boolean scaleDown @@ -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() {