Feat: Set Task Definitions to Inactive#110
Feat: Set Task Definitions to Inactive#110turingbeing wants to merge 1 commit intobuildkite-plugins:masterfrom
Conversation
toote
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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: