-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat(ci): delete unused artifacts in registries #5873
Conversation
Previous behavior: Docker artifacts are costing us a good part of our infrastructure budget, and we needed a way to remove unused artifacts. Expected behavior: Delete unused (not just old) docker artifacts in GAR (Google Artifact Registry), preferably using a generic solution is this needs to be expanded into other Docker registries. Solution: Implement GCR Cleaner https://github.com/GoogleCloudPlatform/gcr-cleaner, as this tools provided integration with `docker/login-action` to interact with multiple Docker v2 registries.
Test run available here: https://github.com/ZcashFoundation/zebra/actions/runs/3732040969/jobs/6330968018 |
Some of the deletions failed:
https://github.com/ZcashFoundation/zebra/actions/runs/3732040969/jobs/6330968018#step:6:183 |
This is happening even when trying to do it manually on those digests, I'm trying to find the root-cause. |
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.
Looks great, thanks for this!
This is happening even when trying to do it manually on those digests, I'm trying to find the root-cause.
I think it's ok for us to delete most of the outdated images, and ignore any errors for now. Then if we end up with a lot of images we can't delete, we can investigate further.
(And sometimes the deletes will work the second time, because we've deleted the images that were depending on those images.)
Co-authored-by: teor <[email protected]>
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.
Looks good!
I ran the workflow manually and it returned an error:
us-docker.pkg.dev/zealous-zebra/zebra/zebrad-test
2 errors occurred:
✗ no refs were deleted
- failed to delete digest sha256:f9d25e9a3b5d405e120767afd82197674caa392bd7fb3f5f7ae0397457442a60: DELETE https://us-docker.pkg.dev/v2/zealous-zebra/zebra/lightwalletd/manifests/sha256:f9d25e9a3b5d405e120767afd82197674caa392bd7fb3f5f7ae0397457442a60: MANIFEST_UNKNOWN: Manifest not found: sha256:f9d25e9a3b5d405e120767afd82197674caa392bd7fb3f5f7ae0397457442a60
- failed to delete digest sha256:f9f02b652de4726fc8e133e489300ccf13a2823b03eb5c572e53e94848ecc1b7: DELETE https://us-docker.pkg.dev/v2/zealous-zebra/zebra/lightwalletd/manifests/sha256:f9f02b652de4726fc8e133e489300ccf13a2823b03eb5c572e53e94848ecc1b7: MANIFEST_UNKNOWN: Manifest not found: sha256:f9f02b652de4726fc8e133e489300ccf13a2823b03eb5c572e53e94848ecc1b7
https://github.com/ZcashFoundation/zebra/actions/runs/3888376395/jobs/6635625756#step:6:24
Can we set continue-on-error
on the gcr-cleaner-cli
step, until we fix these errors?
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
I ran the action manually, and it's working. |
It looks like you ran the main branch action without these changes: Here it is with the changes in this PR: |
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.
Looks good to me, fixing the typo is optional.
Previous behavior:
Docker artifacts are costing us a good part of our infrastructure budget, and we needed a way to remove unused artifacts.
Expected behavior:
Delete unused (not just old) docker artifacts in GAR (Google Artifact Registry), preferably using a generic solution is this needs to be expanded into other Docker registries.
Solution:
Implement GCR Cleaner https://github.com/GoogleCloudPlatform/gcr-cleaner, as this tools provided integration with
docker/login-action
to interact with multiple Docker v2 registries.Fixes #5750
Review
Anyone can review, just have to wait for manual execution to validate it's working
Reviewer Checklist