8000 fix: make sure that ec2 is cleaned up in all cases of flow end · hscmgroup/postgres@ea1ebd1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ea1ebd1

Browse files
samrosedarora
authored andcommitted
fix: make sure that ec2 is cleaned up in all cases of flow end
1 parent 86687f8 commit ea1ebd1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ jobs:
129129
SLACK_MESSAGE: 'Building Postgres AMI failed'
130130
SLACK_FOOTER: ''
131131

132+
- name: Cleanup resources on build cancellation
133+
if: ${{ always() }}
134+
run: |
135+
aws ec2 describe-instances --filters "Name=tag:packerExecutionId,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --instance-ids {}
136+
132137
- name: Cleanup resources on build cancellation
133138
if: ${{ cancelled() }}
134139
run: |

0 commit comments

Comments
 (0)
0