Skip to content

Commit

Permalink
fix: scheduledTasks should also respect config updateStrategy (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbinto authored Jul 23, 2021
1 parent 3f177a5 commit f91d4ba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion awsecs/awsevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func UpdateScheduledTask(args UpdateScheduledTaskArgs) error {
// or if this is even allowed by ECS
// Passing an empty array as the containers to update means gehen will update all
// containers within this task definition to the new sha.
updateTaskDefRes, err := updateTaskDef(taskDefARN, task.Gitsha, config.UpdateStrategyCurrent, []string{}, args.ECSClient)
updateTaskDefRes, err := updateTaskDef(taskDefARN, task.Gitsha, task.UpdateStrategy, []string{}, args.ECSClient)
if err != nil {
return errors.Wrapf(err, "failed to update task def for scheduled task: %s", task.Name)
}
Expand Down
6 changes: 4 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Service struct {
type ScheduledTask struct {
Name string
Gitsha string
UpdateStrategy string
PreviousGitsha string
TaskDefinitionARN string
PreviousTaskDefinitionARN string
Expand Down Expand Up @@ -115,8 +116,9 @@ func Read(configPath, gitsha string) (ParsedConfig, error) {
var scheduledTasks []*ScheduledTask
for name := range config.ScheduledTasks {
task := ScheduledTask{
Name: name,
Gitsha: gitsha,
Name: name,
Gitsha: gitsha,
UpdateStrategy: updateStrategy,
}
scheduledTasks = append(scheduledTasks, &task)
}
Expand Down
20 changes: 12 additions & 8 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ func TestReadServicesWithRole(t *testing.T) {
}
expectedScheduledTasks := []*config.ScheduledTask{
{
Name: "weekly-job",
Gitsha: gitsha,
Name: "weekly-job",
Gitsha: gitsha,
UpdateStrategy: config.UpdateStrategyLatest,
},
{
Name: "monthly-job",
Gitsha: gitsha,
Name: "monthly-job",
Gitsha: gitsha,
UpdateStrategy: config.UpdateStrategyLatest,
},
}

Expand Down Expand Up @@ -70,12 +72,14 @@ func TestReadServicesWithoutRole(t *testing.T) {
}
expectedScheduledTasks := []*config.ScheduledTask{
{
Name: "weekly-job",
Gitsha: gitsha,
Name: "weekly-job",
Gitsha: gitsha,
UpdateStrategy: config.UpdateStrategyCurrent,
},
{
Name: "monthly-job",
Gitsha: gitsha,
Name: "monthly-job",
Gitsha: gitsha,
UpdateStrategy: config.UpdateStrategyCurrent,
},
}

Expand Down

0 comments on commit f91d4ba

Please sign in to comment.