Skip to content

Commit 69c7e65

Browse files
committed
Allow ecs exec to be enabled for the task.
1 parent 4522929 commit 69c7e65

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This action is great for executing migrations or other pre/post deployment steps
2828
cluster: application-cluster
2929
task-definition: application-task-def
3030
assign-public-ip: 'DISABLED'
31+
enable-execute-command: false
3132

3233
subnet-ids: |
3334
subnet-04f133a104b9e95df
@@ -94,21 +95,22 @@ Will pass the following command to the container on the AWS ECS Fargate task:
9495
<!-- action-docs-inputs -->
9596
## Inputs
9697

97-
| parameter | description | required | default |
98-
| --- | --- | --- | --- |
99-
| task-definition | The name or the ARN of the task definition to use for the task. | `true` | |
100-
| subnet-ids | The list of subnet IDs for the task to use. If multiple they should be passed as multiline argument with one subnet ID per line. | `true` | |
101-
| security-group-ids | List of security group IDs for the task. If multiple they should be passed as multiline argument with one subnet ID per line. | `true` | |
102-
| assign-public-ip | Assign public a IP to the task. Options: `['ENABLED', 'DISABLED']` | `false` | DISABLED |
103-
| cluster | Which ECS cluster to start the task in. | `false` | |
104-
| override-container | Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command` must also be set. | `false` | |
105-
| override-container-command | The command to run on the container if `override-container` is passed. | `false` | |
106-
| override-container-environment | Add or override existing environment variables if `override-container` is passed. Provide one per line in key=value format. | `false` | |
107-
| tail-logs | If set to true, will try to extract the logConfiguration for the first container in the task definition. If `override-container` is passed, it will extract the logConfiguration from that container. Tailing logs is only possible if the provided container uses the `awslogs` logDriver. | `false` | true |
108-
| task-wait-until-stopped | Whether to wait for the task to stop before finishing the action. If set to false, the action will finish immediately after the task reaches the `RUNNING` state (fire and forget). | `false` | true |
109-
| task-start-max-wait-time | How long to wait for the task to start (i.e. reach the `RUNNING` state) in seconds. If the task does not start within this time, the pipeline will fail. | `false` | 120 |
110-
| task-stop-max-wait-time | How long to wait for the task to stop (i.e. reach the `STOPPED` state) in seconds. The task will not be canceled after this time, the pipeline will just be marked as failed. | `false` | 300 |
111-
| task-check-state-delay | How long to wait between each AWS API call to check the current state of the task in seconds. This is useful to avoid running into AWS rate limits. **However**, setting this too high might cause the Action to miss the time-window your task is in the "RUNNING" state (if you task is very short lived) and can cause the action to fail. | `false` | 6 |
98+
| parameter | description | required | default |
99+
|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------|
100+
| task-definition | The name or the ARN of the task definition to use for the task. | `true` | |
101+
| subnet-ids | The list of subnet IDs for the task to use. If multiple they should be passed as multiline argument with one subnet ID per line. | `true` | |
102+
| security-group-ids | List of security group IDs for the task. If multiple they should be passed as multiline argument with one subnet ID per line. | `true` | |
103+
| assign-public-ip | Assign public a IP to the task. Options: `['ENABLED', 'DISABLED']` | `false` | DISABLED |
104+
| cluster | Which ECS cluster to start the task in. | `false` | |
105+
| enable-execute-command | Whether to enable the execute command feature for the task. This requires that the ECS cluster has execute command enabled and that the task role has the necessary permissions. | `false` | false |
106+
| override-container | Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command` must also be set. | `false` | |
107+
| override-container-command | The command to run on the container if `override-container` is passed. | `false` | |
108+
| override-container-environment | Add or override existing environment variables if `override-container` is passed. Provide one per line in key=value format. | `false` | |
109+
| tail-logs | If set to true, will try to extract the logConfiguration for the first container in the task definition. If `override-container` is passed, it will extract the logConfiguration from that container. Tailing logs is only possible if the provided container uses the `awslogs` logDriver. | `false` | true |
110+
| task-wait-until-stopped | Whether to wait for the task to stop before finishing the action. If set to false, the action will finish immediately after the task reaches the `RUNNING` state (fire and forget). | `false` | true |
111+
| task-start-max-wait-time | How long to wait for the task to start (i.e. reach the `RUNNING` state) in seconds. If the task does not start within this time, the pipeline will fail. | `false` | 120 |
112+
| task-stop-max-wait-time | How long to wait for the task to stop (i.e. reach the `STOPPED` state) in seconds. The task will not be canceled after this time, the pipeline will just be marked as failed. | `false` | 300 |
113+
| task-check-state-delay | How long to wait between each AWS API call to check the current state of the task in seconds. This is useful to avoid running into AWS rate limits. **However**, setting this too high might cause the Action to miss the time-window your task is in the "RUNNING" state (if you task is very short lived) and can cause the action to fail. | `false` | 6 |
112114
<!-- action-docs-inputs -->
113115

114116
<!-- action-docs-outputs -->

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ inputs:
3636
Which ECS cluster to start the task in.
3737
required: false
3838

39+
enable-execute-command:
40+
description: >-
41+
Whether to enable the execute command feature for the task. This requires
42+
that the ECS cluster has execute command enabled and that the task role
43+
has the necessary permissions.
44+
required: false
45+
default: 'false'
46+
3947
override-container:
4048
description: >-
4149
Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command`

dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56487,6 +56487,7 @@ const main = async () => {
5648756487
const securityGroups = core.getMultilineInput('security-group-ids', {required: true});
5648856488

5648956489
// Inputs: Optional
56490+
const enableExecuteCommand = core.getBooleanInput('enable-execute-command', {required: false});
5649056491
const tailLogs = core.getBooleanInput('tail-logs', {required: false});
5649156492
const assignPublicIp = core.getInput('assign-public-ip', {required: false});
5649256493
const overrideContainer = core.getInput('override-container', {required: false});
@@ -56505,6 +56506,7 @@ const main = async () => {
5650556506
cluster,
5650656507
taskDefinition,
5650756508
launchType: 'FARGATE',
56509+
enableExecuteCommand: enableExecuteCommand,
5650856510
networkConfiguration: {
5650956511
awsvpcConfiguration: {
5651056512
subnets,

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const main = async () => {
2323
const securityGroups = core.getMultilineInput('security-group-ids', {required: true});
2424

2525
// Inputs: Optional
26+
const enableExecuteCommand = core.getBooleanInput('enable-execute-command', {required: false});
2627
const tailLogs = core.getBooleanInput('tail-logs', {required: false});
2728
const assignPublicIp = core.getInput('assign-public-ip', {required: false});
2829
const overrideContainer = core.getInput('override-container', {required: false});
@@ -41,6 +42,7 @@ const main = async () => {
4142
cluster,
4243
taskDefinition,
4344
launchType: 'FARGATE',
45+
enableExecuteCommand: enableExecuteCommand,
4446
networkConfiguration: {
4547
awsvpcConfiguration: {
4648
subnets,

0 commit comments

Comments
 (0)