-
-
Notifications
You must be signed in to change notification settings - Fork 236
feat: cleanup ebs snapshots from testinfra ami's #2098
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: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,8 +146,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) | ||
| 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 on lines
+149
to
+158
|
||
| done | ||
|
Comment on lines
155
to
+159
|
||
| done | ||
| else | ||
| echo "No stage 2 AMI to clean up" | ||
|
|
||
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 PR description/title mention cleaning up EBS volumes, but this change deletes EBS snapshots associated with the AMI. If the intent is snapshot cleanup (likely the actual cost driver), please update the PR description/title for accuracy; if volumes are also being left behind, add a corresponding
describe-volumes/delete-volumecleanup based on the same execution-id tags.