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): Pass moniker to cleanup stages. #1732

Merged
merged 2 commits into from
Oct 25, 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 @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies

import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.clouddriver.pipeline.AbstractCloudProviderAwareStage
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.Location
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup
Expand Down Expand Up @@ -153,10 +154,10 @@ abstract class AbstractDeployStrategyStage extends AbstractCloudProviderAwareSta
return className
}

@Immutable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moniker is not supported by Immutable.

static class CleanupConfig {
String account
String cluster
Moniker moniker
String cloudProvider
Location location

Expand All @@ -166,6 +167,7 @@ abstract class AbstractDeployStrategyStage extends AbstractCloudProviderAwareSta
new CleanupConfig(
account: stageData.account,
cluster: stageData.cluster,
moniker: stageData.moniker,
cloudProvider: stageData.cloudProvider,
location: loc
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CustomStrategy implements Strategy, ApplicationContextAware {
application : stage.context.application,
credentials : cleanupConfig.account,
cluster : cleanupConfig.cluster,
moniker : cleanupConfig.moniker,
(cleanupConfig.location.singularType()): cleanupConfig.location.value,
cloudProvider : cleanupConfig.cloudProvider,
strategy : true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class HighlanderStrategy implements Strategy, ApplicationContextAware {
Map shrinkContext = [
(cleanupConfig.location.singularType()): cleanupConfig.location.value,
cluster : cleanupConfig.cluster,
moniker : cleanupConfig.moniker,
credentials : cleanupConfig.account,
cloudProvider : cleanupConfig.cloudProvider,
shrinkToSize : 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class RedBlackStrategy implements Strategy, ApplicationContextAware {
(cleanupConfig.location.singularType()): cleanupConfig.location.value,
cluster : cleanupConfig.cluster,
credentials : cleanupConfig.account,
moniker : cleanupConfig.moniker,
cloudProvider : cleanupConfig.cloudProvider,
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class RollingRedBlackStrategy implements Strategy, ApplicationContextAware {
Map baseContext = [
(cleanupConfig.location.singularType()): cleanupConfig.location.value,
cluster : cleanupConfig.cluster,
moniker : cleanupConfig.moniker,
credentials : cleanupConfig.account,
cloudProvider : cleanupConfig.cloudProvider,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies

import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.clouddriver.pipeline.cluster.DisableClusterStage
import com.netflix.spinnaker.orca.clouddriver.pipeline.cluster.ScaleDownClusterStage
import com.netflix.spinnaker.orca.clouddriver.pipeline.cluster.ShrinkClusterStage
Expand All @@ -32,10 +33,12 @@ class RedBlackStrategySpec extends Specification {

def "should compose flow"() {
given:
Moniker moniker = new Moniker(app: "unit", stack: "test");
def ctx = [
account : "testAccount",
application : "unit",
stack : "tests",
moniker : moniker,
cloudProvider : "aws",
region : "north",
availabilityZones: [
Expand All @@ -60,6 +63,7 @@ class RedBlackStrategySpec extends Specification {
credentials : "testAccount",
cloudProvider : "aws",
cluster : "unit-tests",
moniker : moniker,
region : "north",
remainingEnabledServerGroups : 1,
preferLargerOverNewer : false,
Expand Down