Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/testinfra-ami-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,17 @@ jobs:

if [ -n "$STAGE2_AMI_IDS" ]; then
for ami_id in $STAGE2_AMI_IDS; do
SNAPSHOT_IDS=$(aws ec2 describe-images \
--region ap-southeast-1 \
--image-ids "$ami_id" \
--query 'Images[*].BlockDeviceMappings[*].Ebs.SnapshotId' \
--output text)
Comment thread
jfreeland marked this conversation as resolved.
echo "Deregistering stage 2 AMI: $ami_id"
aws ec2 deregister-image --region ap-southeast-1 --image-id "$ami_id" || true
for snap_id in $SNAPSHOT_IDS; do
echo "Deleting snapshot: $snap_id"
aws ec2 delete-snapshot --region ap-southeast-1 --snapshot-id "$snap_id" || true
Comment thread
jfreeland marked this conversation as resolved.
done
Comment thread
jfreeland marked this conversation as resolved.
done
else
echo "No stage 2 AMI to clean up"
Expand Down
Loading