Skip to content

Commit

Permalink
Add a flag to skip running standalone task during deployment (#4666)
Browse files Browse the repository at this point in the history
* Add a flag to skip running standalone task during deployment

Signed-off-by: Kenta Kozuka <[email protected]>

* Fix docs

Signed-off-by: Kenta Kozuka <[email protected]>

---------

Signed-off-by: Kenta Kozuka <[email protected]>
  • Loading branch information
kentakozuka authored and ffjlabo committed Nov 13, 2023
1 parent 2eed512 commit bf9c092
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ One of `yamlField` or `regex` is required.
| serviceDefinitionFile | string | The path ECS Service configuration file. Allow file in both `yaml` and `json` format. The default value is `service.json`. See [here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_definition_parameters.html) for parameters.| No |
| taskDefinitionFile | string | The path to ECS TaskDefinition configuration file. Allow file in both `yaml` and `json` format. The default value is `taskdef.json`. See [here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) for parameters. | No |
| targetGroups | [ECSTargetGroupInput](#ecstargetgroupinput) | The target groups configuration, will be used to routing traffic to created task sets. | Yes (if you want to perform progressive delivery) |
| runStandaloneTask | bool | Run standalone tasks during deployments. About standalone task, see [here](https://docs.aws.amazon.com/AmazonECS/latest/userguide/ecs_run_task-v2.html). The default value is `true`. |

### ECSTargetGroupInput

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ One of `yamlField` or `regex` is required.
| serviceDefinitionFile | string | The path ECS Service configuration file. Allow file in both `yaml` and `json` format. The default value is `service.json`. See [here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_definition_parameters.html) for parameters.| No |
| taskDefinitionFile | string | The path to ECS TaskDefinition configuration file. Allow file in both `yaml` and `json` format. The default value is `taskdef.json`. See [here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) for parameters. | No |
| targetGroups | [ECSTargetGroupInput](#ecstargetgroupinput) | The target groups configuration, will be used to routing traffic to created task sets. | Yes (if you want to perform progressive delivery) |
| runStandaloneTask | bool | Run standalone tasks during deployments. About standalone task, see [here](https://docs.aws.amazon.com/AmazonECS/latest/userguide/ecs_run_task-v2.html). The default value is `true`. |

### ECSTargetGroupInput

Expand Down
5 changes: 5 additions & 0 deletions pkg/app/piped/executor/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ func runStandaloneTask(
return false
}

if !*ecsInput.RunStandaloneTask {
in.LogPersister.Infof("Skipped running task")
return true
}

err = client.RunTask(
ctx,
*td,
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application_ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type ECSDeploymentInput struct {
// Automatically reverts all changes from all stages when one of them failed.
// Default is true.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
// Run standalone task during deployment.
// Default is true.
RunStandaloneTask *bool `json:"runStandaloneTask" default:"true"`
}

func (in *ECSDeploymentInput) IsStandaloneTask() bool {
Expand Down
5 changes: 3 additions & 2 deletions pkg/config/application_ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ func TestECSApplicationConfig(t *testing.T) {
TargetGroups: ECSTargetGroups{
Primary: json.RawMessage(`{"containerName":"web","containerPort":80,"targetGroupArn":"arn:aws:elasticloadbalancing:xyz"}`),
},
LaunchType: "FARGATE",
AutoRollback: newBoolPointer(true),
LaunchType: "FARGATE",
AutoRollback: newBoolPointer(true),
RunStandaloneTask: newBoolPointer(true),
},
},
expectedError: nil,
Expand Down

0 comments on commit bf9c092

Please sign in to comment.