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: Add updateStrategy: redeploy #45

Merged
merged 1 commit into from
Oct 19, 2021
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The possible values are:

- `current`: Create a new task definition based off the revision the service is currently using.
- `latest`: Create a new task definition based off the latest revision available.
- `redeploy`: Skips creating a new task definition, but still deploys the ECS service.
- `none`: Disable updating services. This prevents Gehen from deploying a new version of the service.

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion awsecs/awsecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func updateTaskDef(ctx context.Context, taskDefARN, gitsha, updateStrategy strin
}

// Only update if we find an existing image that is different from the new gitsha
if gitsha == previousGitsha {
if gitsha == previousGitsha || updateStrategy == config.UpdateStrategyRedeploy {
continue
}

Expand Down
9 changes: 5 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
)

const (
UpdateStrategyCurrent = "current"
UpdateStrategyLatest = "latest"
UpdateStrategyNone = "none"
UpdateStrategyCurrent = "current"
UpdateStrategyLatest = "latest"
UpdateStrategyRedeploy = "redeploy"
UpdateStrategyNone = "none"
)

type serviceConfig struct {
Expand Down Expand Up @@ -91,7 +92,7 @@ func Read(configPath, gitsha string) (ParsedConfig, error) {

updateStrategy := strings.ToLower(config.UpdateStrategy)
switch updateStrategy {
case UpdateStrategyCurrent, UpdateStrategyLatest, UpdateStrategyNone:
case UpdateStrategyCurrent, UpdateStrategyLatest, UpdateStrategyRedeploy, UpdateStrategyNone:
case "":
// Default is current
updateStrategy = UpdateStrategyCurrent
Expand Down