-
Notifications
You must be signed in to change notification settings - Fork 26
Feat: Set Task Definitions to Inactive #110
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
base: master
Are you sure you want to change the base?
Feat: Set Task Definitions to Inactive #110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great PR!
left a few comments here and there about code organization and execution flow
| --output text) | ||
|
|
||
| # Array | ||
| readarray -t active_task_defs <<<"$all_active_task_defs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the readarray/mapfiles function can not be assumed to exist in all environments so I'd suggest an alternative
| # Remove the current task definition from the list | ||
| for i in "${!active_task_defs[@]}"; do | ||
| if [[ "${active_task_defs[$i]}" == *":${task_revision}"* ]]; then | ||
| unset 'active_task_defs[$i]' | ||
| fi | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looping through all active definitions to remove a single element may be a bad idea... I'd suggest doing this check in the next loop while removing them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is for plugin-specific functionality, I'd suggest creating the function in the main file or creating a new library file for these kind of things
| all_active_task_defs=$(aws ecs list-task-definitions \ | ||
| --family-prefix "${task_family}" \ | ||
| --query 'taskDefinitionArns[]' \ | ||
| --output text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make sure to re-use the default options to aws commands like it is done on the hook file because it may include regions without which the commands will probably fail
| for task_def in "${active_task_defs[@]}"; do | ||
| echo "Deregistering $task_def" | ||
| aws ecs deregister-task-definition --task-definition "$task_def" | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make sure to re-use the default options to aws commands like it is done on the hook file because it may include regions without which the commands will probably fail
|
Thanks for the feedback @toote I'll make some changes, currently enjoying some holiday, so might be another week yet 👍 |
Adds a new conditional feature to set previous task definitions to
INACTIVE, currently old definitions are leftACTIVE. The feature is optionally controlled via thederegister-tasksflag and isfalseby default.Adds:
deregister_old_task_definitionsfunction inplugin.bashUpdates: