Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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 @@ -104,6 +104,7 @@ Will pass the following command to the container on the AWS ECS Fargate task:
| 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-stopped-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 |
<!-- action-docs-inputs -->

<!-- action-docs-outputs -->
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ inputs:
required: false
default: 300

task-check-state-delay:
description: >-
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.
required: false
default: 6

outputs:
task-arn:
description: 'The full ARN for the task that was ran.'
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73927,6 +73927,7 @@ const main = async () => {
const taskWaitUntilStopped = core.getBooleanInput('task-wait-until-stopped', {required: false});
const taskStartMaxWaitTime = parseInt(core.getInput('task-start-max-wait-time', {required: false}));
const taskStoppedMaxWaitTime = parseInt(core.getInput('task-stopped-max-wait-time', {required: false}));
const taskCheckStateDelay = parseInt(core.getInput('task-check-state-delay', {required: false}));

// Build Task parameters
const taskRequestParams = {
Expand Down Expand Up @@ -74008,6 +74009,8 @@ const main = async () => {
await waitUntilTasksRunning({
client: ecs,
maxWaitTime: taskStartMaxWaitTime,
maxDelay: taskCheckStateDelay,
minDelay: taskCheckStateDelay,
}, {cluster, tasks: [taskArn]});
} catch (error) {
core.setFailed(`Task did not start successfully. Error: ${error.name}. State: ${error.state}.`);
Expand Down Expand Up @@ -74079,6 +74082,8 @@ const main = async () => {
await waitUntilTasksStopped({
client: ecs,
maxWaitTime: taskStoppedMaxWaitTime,
maxDelay: taskCheckStateDelay,
minDelay: taskCheckStateDelay,
}, {
cluster,
tasks: [taskArn],
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const main = async () => {
const taskWaitUntilStopped = core.getBooleanInput('task-wait-until-stopped', {required: false});
const taskStartMaxWaitTime = parseInt(core.getInput('task-start-max-wait-time', {required: false}));
const taskStoppedMaxWaitTime = parseInt(core.getInput('task-stopped-max-wait-time', {required: false}));
const taskCheckStateDelay = parseInt(core.getInput('task-check-state-delay', {required: false}));

// Build Task parameters
const taskRequestParams = {
Expand Down Expand Up @@ -110,6 +111,8 @@ const main = async () => {
await waitUntilTasksRunning({
client: ecs,
maxWaitTime: taskStartMaxWaitTime,
maxDelay: taskCheckStateDelay,
minDelay: taskCheckStateDelay,
}, {cluster, tasks: [taskArn]});
} catch (error) {
core.setFailed(`Task did not start successfully. Error: ${error.name}. State: ${error.state}.`);
Expand Down Expand Up @@ -181,6 +184,8 @@ const main = async () => {
await waitUntilTasksStopped({
client: ecs,
maxWaitTime: taskStoppedMaxWaitTime,
maxDelay: taskCheckStateDelay,
minDelay: taskCheckStateDelay,
}, {
cluster,
tasks: [taskArn],
Expand Down