Repository navigation
Conversation
caugner
added this pull request to stack #593
October 16, 2026 18:16
`Bucket.deleteFiles()` removes objects one at a time with a parallelism of 10, which takes tens of minutes for a full build. `gcloud storage rm --recursive` deletes in bulk, is already on the runner, and avoids the extra dependency. List with `gcloud storage ls`, whose output contains only the immediate children of `deployments/`. Keep only the tail of gcloud's stderr, since `rm` prints a status line per object.
Keep a single definition of a valid deployment prefix instead of a second, looser regex in `getActiveDeployment()`.
Separate the pure expired/retained/unrecognized split from listing and deletion so it can be unit-tested, and only run `main()` when the script is executed directly.
Cleanup runs after the function deploy succeeded, so a transient storage or auth error must not fail the run or skip the remaining steps.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clean up expired deployment prefixes after prod, stage, and test deployments.
Motivation
Keep the release-specific deployment folders introduced by #573 from accumulating indefinitely while ensuring active functions retain their source content.
Additional details
deployments/withgcloud storage ls, then delete each expired prefix withgcloud storage rm --recursive, which deletes in bulk.gcloud functionsand run storage cleanup with the content service account.continue-on-error, since they run after the deploy succeeded.Related issues and pull requests
Depends on: