Skip to content

Commit d174d53

Browse files
Add rolling blue green strategy flag
1 parent 9969bcb commit d174d53

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

commands/deploy_command.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
123123
util.GetShortOption(allModulesOpt): "Deploy all modules which are contained in the deployment descriptor, in the current location",
124124
util.GetShortOption(allResourcesOpt): "Deploy all resources which are contained in the deployment descriptor, in the current location",
125125
util.GetShortOption(retriesOpt): "Retry the operation N times in case a non-content error occurs (default 3)",
126-
util.GetShortOption(strategyOpt): "Specify the deployment strategy when updating an mta (default, blue-green)",
127-
util.GetShortOption(skipTestingPhase): "(STRATEGY: BLUE-GREEN) Do not require confirmation for deleting the previously deployed MTA app",
128-
util.GetShortOption(skipIdleStart): "(STRATEGY: BLUE-GREEN) Directly start the new MTA version as 'live', skipping the 'idle' phase of the resources. Do not require further confirmation or testing before deleting the old version",
126+
util.GetShortOption(strategyOpt): "Specify the deployment strategy when updating an mta (default, blue-green, (EXPERIMENTAL) incremental-blue-green)",
127+
util.GetShortOption(skipTestingPhase): "(STRATEGY: BLUE-GREEN, (EXPERIMENTAL) INCREMENTAL-BLUE-GREEN) Do not require confirmation for deleting the previously deployed MTA app",
128+
util.GetShortOption(skipIdleStart): "(STRATEGY: BLUE-GREEN, (EXPERIMENTAL) INCREMENTAL-BLUE-GREEN) Directly start the new MTA version as 'live', skipping the 'idle' phase of the resources. Do not require further confirmation or testing before deleting the old version",
129129
},
130130
},
131131
}

commands/deployment_strategy.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ func (d *DeployCommandDeploymentStrategy) CreateProcessBuilder() *util.ProcessBu
2020
}
2121

2222
type BlueGreenDeployCommandDeploymentStrategy struct {
23-
noConfirm bool
24-
skipIdleStart bool
23+
noConfirm bool
24+
skipIdleStart bool
25+
incrementalDeploy bool
2526
}
2627

2728
func (b *BlueGreenDeployCommandDeploymentStrategy) CreateProcessBuilder() *util.ProcessBuilder {
@@ -30,23 +31,29 @@ func (b *BlueGreenDeployCommandDeploymentStrategy) CreateProcessBuilder() *util.
3031
processBuilder.Parameter("noConfirm", strconv.FormatBool(b.noConfirm))
3132
processBuilder.Parameter("skipIdleStart", strconv.FormatBool(b.skipIdleStart))
3233
processBuilder.Parameter("keepOriginalAppNamesAfterDeploy", strconv.FormatBool(true))
34+
processBuilder.Parameter("shouldApplyIncrementalInstancesUpdate", strconv.FormatBool(b.incrementalDeploy))
3335
return processBuilder
3436
}
3537

3638
func NewDeploymentStrategy(flags *flag.FlagSet, typeProvider ProcessTypeProvider) DeploymentStrategy {
3739
if typeProvider.GetProcessType() == (blueGreenDeployCommandProcessTypeProvider{}).GetProcessType() {
38-
return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(noConfirmOpt, flags), GetBoolOpt(skipIdleStart, flags)}
40+
return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(noConfirmOpt, flags), GetBoolOpt(skipIdleStart, flags), isIncrementalBlueGreen(flags)}
3941
}
4042
strategy := GetStringOpt(strategyOpt, flags)
4143
if strategy == "default" {
4244
return &DeployCommandDeploymentStrategy{}
4345
}
4446
if GetBoolOpt(skipIdleStart, flags) {
45-
return &BlueGreenDeployCommandDeploymentStrategy{true, true}
47+
return &BlueGreenDeployCommandDeploymentStrategy{true, true, isIncrementalBlueGreen(flags)}
4648
}
47-
return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(skipTestingPhase, flags), false}
49+
return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(skipTestingPhase, flags), false, isIncrementalBlueGreen(flags)}
50+
}
51+
52+
func isIncrementalBlueGreen(flags *flag.FlagSet) bool {
53+
strategy := GetStringOpt(strategyOpt, flags)
54+
return strategy == "incremental-blue-green"
4855
}
4956

5057
func AvailableStrategies() []string {
51-
return []string{"blue-green", "default"}
58+
return []string{"blue-green", "incremental-blue-green", "default"}
5259
}

0 commit comments

Comments
 (0)