diff --git a/commands/deploy_command.go b/commands/deploy_command.go index 8c947e8..00220e6 100644 --- a/commands/deploy_command.go +++ b/commands/deploy_command.go @@ -123,9 +123,9 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command { util.GetShortOption(allModulesOpt): "Deploy all modules which are contained in the deployment descriptor, in the current location", util.GetShortOption(allResourcesOpt): "Deploy all resources which are contained in the deployment descriptor, in the current location", util.GetShortOption(retriesOpt): "Retry the operation N times in case a non-content error occurs (default 3)", - util.GetShortOption(strategyOpt): "Specify the deployment strategy when updating an mta (default, blue-green)", - util.GetShortOption(skipTestingPhase): "(STRATEGY: BLUE-GREEN) Do not require confirmation for deleting the previously deployed MTA app", - 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", + util.GetShortOption(strategyOpt): "Specify the deployment strategy when updating an mta (default, blue-green, (EXPERIMENTAL) incremental-blue-green)", + util.GetShortOption(skipTestingPhase): "(STRATEGY: BLUE-GREEN, (EXPERIMENTAL) INCREMENTAL-BLUE-GREEN) Do not require confirmation for deleting the previously deployed MTA app", + 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", }, }, } diff --git a/commands/deployment_strategy.go b/commands/deployment_strategy.go index 8f71560..2abe61e 100644 --- a/commands/deployment_strategy.go +++ b/commands/deployment_strategy.go @@ -20,8 +20,9 @@ func (d *DeployCommandDeploymentStrategy) CreateProcessBuilder() *util.ProcessBu } type BlueGreenDeployCommandDeploymentStrategy struct { - noConfirm bool - skipIdleStart bool + noConfirm bool + skipIdleStart bool + incrementalDeploy bool } func (b *BlueGreenDeployCommandDeploymentStrategy) CreateProcessBuilder() *util.ProcessBuilder { @@ -30,23 +31,29 @@ func (b *BlueGreenDeployCommandDeploymentStrategy) CreateProcessBuilder() *util. processBuilder.Parameter("noConfirm", strconv.FormatBool(b.noConfirm)) processBuilder.Parameter("skipIdleStart", strconv.FormatBool(b.skipIdleStart)) processBuilder.Parameter("keepOriginalAppNamesAfterDeploy", strconv.FormatBool(true)) + processBuilder.Parameter("shouldApplyIncrementalInstancesUpdate", strconv.FormatBool(b.incrementalDeploy)) return processBuilder } func NewDeploymentStrategy(flags *flag.FlagSet, typeProvider ProcessTypeProvider) DeploymentStrategy { if typeProvider.GetProcessType() == (blueGreenDeployCommandProcessTypeProvider{}).GetProcessType() { - return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(noConfirmOpt, flags), GetBoolOpt(skipIdleStart, flags)} + return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(noConfirmOpt, flags), GetBoolOpt(skipIdleStart, flags), isIncrementalBlueGreen(flags)} } strategy := GetStringOpt(strategyOpt, flags) if strategy == "default" { return &DeployCommandDeploymentStrategy{} } if GetBoolOpt(skipIdleStart, flags) { - return &BlueGreenDeployCommandDeploymentStrategy{true, true} + return &BlueGreenDeployCommandDeploymentStrategy{true, true, isIncrementalBlueGreen(flags)} } - return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(skipTestingPhase, flags), false} + return &BlueGreenDeployCommandDeploymentStrategy{GetBoolOpt(skipTestingPhase, flags), false, isIncrementalBlueGreen(flags)} +} + +func isIncrementalBlueGreen(flags *flag.FlagSet) bool { + strategy := GetStringOpt(strategyOpt, flags) + return strategy == "incremental-blue-green" } func AvailableStrategies() []string { - return []string{"blue-green", "default"} + return []string{"blue-green", "incremental-blue-green", "default"} }