Skip to content

Commit

Permalink
fix: only delete form viewer task definitions (#4168)
Browse files Browse the repository at this point in the history
Update the task definition cleanup workflow so that it only
deletes form-viewer task definitions.
  • Loading branch information
patheard committed Aug 7, 2024
1 parent eb18e7d commit 382ad49
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/delete-ecs-task-defs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
# Retrieves all ACTIVE task definitions except for the 5 most recent
- name: Get ACTIVE ECS task definitions
env:
TASK_NAME: form-viewer
TASK_STATUS: ACTIVE
TASKS_TO_KEEP: 6 # 1 greater than number to keep
run: |
Expand All @@ -44,7 +45,7 @@ jobs:
--status ${{ env.TASK_STATUS }} \
--region ${{ env.AWS_REGION }} \
--no-cli-pager \
| jq -r '(.taskDefinitionArns[:length-${{ env.TASKS_TO_KEEP }}])[]' > task-def-active-arns.txt
| jq -r '(.taskDefinitionArns | map(select(contains("${{ env.TASK_NAME }}")))[:length-${{ env.TASKS_TO_KEEP }}])[]' > task-def-active-arns.txt
- name: Set ECS tasks to INACTIVE
run: |
Expand All @@ -53,6 +54,7 @@ jobs:
# Retrieves all INACTIVE task definitions except for the 100 most recent
- name: Get INACTIVE ECS task definitions
env:
TASK_NAME: form-viewer
TASK_STATUS: INACTIVE
TASKS_TO_KEEP: 101 # 1 greater than number to keep
run: |
Expand All @@ -61,7 +63,7 @@ jobs:
--status ${{ env.TASK_STATUS }} \
--region ${{ env.AWS_REGION }} \
--no-cli-pager \
| jq -r '(.taskDefinitionArns[:length-${{ env.TASKS_TO_KEEP }}])[]' > task-def-inactive-arns.txt
| jq -r '(.taskDefinitionArns | map(select(contains("${{ env.TASK_NAME }}")))[:length-${{ env.TASKS_TO_KEEP }}])[]' > task-def-inactive-arns.txt
- name: Delete INACTIVE ECS task definitions
run: |
Expand Down

0 comments on commit 382ad49

Please sign in to comment.