Skip to content

Add a new command to setup a cleanup policy for functions artifacts - #8268

Merged
taeold merged 12 commits into
masterfrom
dl-artifacts-cleanup-policy
Mar 14, 2025
Merged

taeold merged 12 commits into
masterfrom
dl-artifacts-cleanup-policy

Conversation

@taeold

@taeold taeold commented Feb 27, 2025 •

Copy link
Copy Markdown
Contributor

Add command functions:artifacts:setpolicy.

This new command leverages Artifact Registry's cleanup policies feature. Cleanup policies are a managed service feature that automatically removes container images based on configurable rules, providing a more robust and transparent solution.

The command simplifies the process of configuring these policies for Cloud Run functions repositories. By default, the command sets up a policy that deletes images older than 3 days. Users can easily adjust this retention period using the --days option.

The command handles checking if the user already has a cleanup policy set up. The cli command will check if a clean up policy exists, and if so, will prompt the user if they wish to proceed.

@taeold taeold changed the title Add new command to setup a cleanup policy for functions artifacts Add a new command to setup a cleanup policy for functions artifacts Mar 10, 2025
@taeold
taeold marked this pull request as ready for review March 12, 2025 22:13
@taeold
taeold requested review from blidd-google and inlined March 12, 2025 22:13
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts Outdated
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts Outdated
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts Outdated
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts
Comment thread src/commands/functions-artifacts-setup-cleanup-policy.ts Outdated
Comment thread src/functions/artifacts.ts Outdated
Comment thread src/gcp/artifactregistry.ts Outdated
Comment thread src/gcp/artifactregistry.ts Outdated
Comment thread src/gcp/artifactregistry.ts Outdated

@inlined inlined left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I assume this can go in as reverse compatible and in the vNext branch you're going to take a swing at checking the policy on deployment and removing the ArtifactCleaner (and its related experiments)?

Comment thread src/commands/functions-artifacts-setpolicy.ts
Comment thread src/functions/artifacts.ts Outdated
@taeold

taeold commented Mar 14, 2025

Copy link
Copy Markdown
Contributor Author

@inlined yep that's the plan. Added that work in go/firebase-tools-14, and will work on it soon.

@taeold
taeold enabled auto-merge (squash) March 14, 2025 17:13
@taeold
taeold merged commit 3bb75a0 into master Mar 14, 2025
@taeold
taeold deleted the dl-artifacts-cleanup-policy branch March 14, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants