You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automate Artifact Registry image cleanup + purge dead repos
The image repos accumulated ~628 GiB that nothing prunes (~$45/mo storage).
Ongoing (in the deploy pipeline):
- cleanup_app_engine_versions.sh: when it deletes an App Engine version, also
delete that version's gae-flexible Flex image, so the repo stays in lockstep
with the retained versions. Version-aware because a blind keep-N would delete
a kept stopped-prod version's image (staging/prod images interleave).
- cleanup_cloud_run_images.sh + a cleanup-cloud-run-images job: keep the 15 most
recent Cloud Run images, delete older. Sorts in-script by createTime since
gcloud's Artifact Registry --sort-by proved unreliable.
One-time:
- purge_stale_artifact_registry.sh (interactive): after a safety pre-check,
delete the dead legacy repos (us.gcr.io ~540 GiB, gcr.io, cloud-run-source-
deploy), prune gae-flexible orphans, and prune Cloud Run to 15.
Tests extended with a stubbed gcloud artifacts. Cuts AR storage to a few $/mo.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Prune Artifact Registry images automatically so the image repos stop growing without bound. After each deploy the pipeline keeps the 15 most recent Cloud Run images and deletes each removed App Engine version's Flex (`gae-flexible`) image. Adds a one-time `purge_stale_artifact_registry.sh` to delete the dead legacy image repos (`us.gcr.io`, `gcr.io`, `cloud-run-source-deploy`) and orphaned `gae-flexible` images. This cuts Artifact Registry storage (~628 GiB, ~$45/mo) to a few dollars.
0 commit comments