diff --git a/README.md b/README.md index 611b389..6a3455e 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ This action is great for executing migrations or other pre/post deployment steps cluster: application-cluster task-definition: application-task-def assign-public-ip: 'DISABLED' + enable-execute-command: false subnet-ids: | subnet-04f133a104b9e95df @@ -94,21 +95,22 @@ Will pass the following command to the container on the AWS ECS Fargate task: ## Inputs -| parameter | description | required | default | -| --- | --- | --- | --- | -| task-definition | The name or the ARN of the task definition to use for the task. | `true` | | -| 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` | | -| 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` | | -| assign-public-ip | Assign public a IP to the task. Options: `['ENABLED', 'DISABLED']` | `false` | DISABLED | -| cluster | Which ECS cluster to start the task in. | `false` | | -| override-container | Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command` must also be set. | `false` | | -| override-container-command | The command to run on the container if `override-container` is passed. | `false` | | -| override-container-environment | Add or override existing environment variables if `override-container` is passed. Provide one per line in key=value format. | `false` | | -| 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 | -| 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 | -| 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 | -| 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 | -| 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 | +| parameter | description | required | default | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------| +| task-definition | The name or the ARN of the task definition to use for the task. | `true` | | +| 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` | | +| 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` | | +| assign-public-ip | Assign public a IP to the task. Options: `['ENABLED', 'DISABLED']` | `false` | DISABLED | +| cluster | Which ECS cluster to start the task in. | `false` | | +| 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 | +| override-container | Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command` must also be set. | `false` | | +| override-container-command | The command to run on the container if `override-container` is passed. | `false` | | +| override-container-environment | Add or override existing environment variables if `override-container` is passed. Provide one per line in key=value format. | `false` | | +| 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 | +| 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 | +| 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 | +| 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 | +| 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 | diff --git a/action.yml b/action.yml index f31bd9e..9101532 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,14 @@ inputs: Which ECS cluster to start the task in. required: false + enable-execute-command: + description: >- + 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. + required: false + default: 'false' + override-container: description: >- Will use `containerOverrides` to run a custom command on the container. If provided, `override-container-command` diff --git a/dist/index.js b/dist/index.js index 61bff0a..97be37e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -56487,6 +56487,7 @@ const main = async () => { const securityGroups = core.getMultilineInput('security-group-ids', {required: true}); // Inputs: Optional + const enableExecuteCommand = core.getBooleanInput('enable-execute-command', {required: false}); const tailLogs = core.getBooleanInput('tail-logs', {required: false}); const assignPublicIp = core.getInput('assign-public-ip', {required: false}); const overrideContainer = core.getInput('override-container', {required: false}); @@ -56505,6 +56506,7 @@ const main = async () => { cluster, taskDefinition, launchType: 'FARGATE', + enableExecuteCommand: enableExecuteCommand, networkConfiguration: { awsvpcConfiguration: { subnets, diff --git a/index.js b/index.js index 0e09a48..5c9a7f9 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,7 @@ const main = async () => { const securityGroups = core.getMultilineInput('security-group-ids', {required: true}); // Inputs: Optional + const enableExecuteCommand = core.getBooleanInput('enable-execute-command', {required: false}); const tailLogs = core.getBooleanInput('tail-logs', {required: false}); const assignPublicIp = core.getInput('assign-public-ip', {required: false}); const overrideContainer = core.getInput('override-container', {required: false}); @@ -41,6 +42,7 @@ const main = async () => { cluster, taskDefinition, launchType: 'FARGATE', + enableExecuteCommand: enableExecuteCommand, networkConfiguration: { awsvpcConfiguration: { subnets,