-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance run-task
to allow streaming of logs from ecs task and waiting till completion
#101
Comments
run-task
to allow streaming of logs from ecs task and waiting till completion
Here is my piece of bash to wait till task completes and fail if container exit code is not 0: set -euo pipefail
TASK_ARN=$(aws ecs list-tasks --family=authorizer-migration|jq '.taskArns[]' -r)
if [ -z "$TASK_ARN" ]; then
echo "Task was not found"
exit 1
fi
aws ecs wait tasks-stopped --tasks $TASK_ARN
aws ecs describe-tasks --tasks $TASK_ARN|jq -e '.tasks[0].containers[0].exitCode == 0' Have no time for PR, hope someone can improve it to be usable |
A slight variation of the above worked well for me as a replacement for the TASK_ARN="$(aws ecs run-task --cluster $ECS_CLUSTER_NAME --task-definition migrations-production --count 1 --launch-type EC2 | jq '.tasks[0].taskArn' -r)"
aws ecs wait tasks-stopped --cluster $ECS_CLUSTER_NAME --tasks $TASK_ARN
aws ecs describe-tasks --cluster $ECS_CLUSTER_NAME --tasks $TASK_ARN | jq -e '.tasks[0].containers[0].exitCode == 0' Thanks @gugu 💚 |
Hey @gugu, I'm working on updating this orb at the moment and wanted to understand your request a little bit more. Right now, when running the
Is there something else that's missing in this output that you need? Please let me know and I'll see if we can add it for you. Best, |
What would you like to be added
Add the ability to stream logs from an ecs task and wait till completion of the task being run by the orb.
Why is this needed
This is useful for long-running tasks like database migrator tasks.
Related references
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-logs.html
The text was updated successfully, but these errors were encountered: