Skip to content
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

chore(cleanup AWS) garbage collect EC2 snapshots older than 1 year on us-east-2 #587

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

dduportal
Copy link
Contributor

@dduportal dduportal commented Apr 11, 2023

Implements jenkins-infra/helpdesk#2846 (comment), in the context of jenkins-infra/helpdesk#3502.

This PR add a GC for AWS snapshots, restricted to us-east-2 .

@dduportal
Copy link
Contributor Author

Initial build was too long (more than 20 min and counting). Let's start slowly with a 12month threshold for the first cleanup operation.

@dduportal dduportal changed the title chore(cleanup AWS) garbage collect EC2 snapshots chore(cleanup AWS) garbage collect EC2 snapshots older than 1 year on us-east-2 Apr 11, 2023
@dduportal
Copy link
Contributor Author

  • With the "1 year" threshold, the dry run GC for snapshots took ~12 min. Let's start with this value.
  • Stopped the build (as no need to consume VMs for this script to run).

@dduportal dduportal marked this pull request as ready for review April 11, 2023 14:08
Copy link
Member

@lemeurherve lemeurherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, wondering if regrouping the two scripts together would worth it 🤔
(It seems to me they are almost similar except for the query, the cleanup command parameter and the subject of the log messages)

cleanup/aws_snapshots.sh Show resolved Hide resolved
cleanup/aws_snapshots.sh Show resolved Hide resolved
cleanup/aws_snapshots.sh Outdated Show resolved Hide resolved
cleanup/aws_images.sh Outdated Show resolved Hide resolved
@dduportal dduportal requested a review from lemeurherve April 11, 2023 14:26
Copy link
Member

@lemeurherve lemeurherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Interested to know nonetheless WDYT about #587 (review)

@dduportal dduportal merged commit c26ca30 into jenkins-infra:main Apr 11, 2023
@dduportal dduportal deleted the chore/cleanup-aws-snapshots branch April 11, 2023 15:24
@dduportal
Copy link
Contributor Author

LGTM, wondering if regrouping the two scripts together would worth it 🤔 (It seems to me they are almost similar except for the query, the cleanup command parameter and the subject of the log messages)

The goal is to keep a list of simpler scripts to be run independantly of each other.
There are also slight difference between commands: we could factorize but it's not the effort on my opinion

@dduportal
Copy link
Contributor Author

This PR, once applied, failed the GC with the following error:

An error occurred (InvalidSnapshot.InUse) when calling the DeleteSnapshot operation: The snapshot snap-0639dfcc718eaf8db is currently in use by ami-0995d04457d9af25e
  • Build continues so not a blocker, but no GC is applied to snapshots :'(
  • Incoming PRs:
    • Parallellize (and avoid fail fast) when deleting images to fix the above error
    • Cleaning up staging images (more deregistered AMIs)
    • Cleaning up prod images (more deregistered AMIs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants