Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your team manages automated CI/CD artifact lifecycles across development and production environments using Google Cloud Artifact Registry. Frequent automated pipeline runs are rapidly inflating cloud storage costs with intermediate untagged layers and expired preview builds.
You need to configure automated repository cleanup policies to enforce the following governance and retention criteria:
prod- prefix from deletion indefinitely.feat- prefix that are older than 30 days.Which cleanup policy configuration should you implement in Artifact Registry?
Artifact Registry Cleanup Policies provide automated, declarative lifecycle management directly on container and language repositories. They allow platform engineers to define granular rules using conditions such as tag status, tag prefixes, version age, and version count limits to automate storage optimization without requiring custom cron scripts or maintenance tools.
KEEP policy with mostRecentVersions.keepCount: 10 evaluates all versions in the repository and unconditionally preserves the newest 10 artifacts regardless of any other matching deletion rules.prod- tagged releases: Defining a KEEP policy matching tagState: TAGGED with tagPrefixes: ["prod-"] ensures that any version bearing a production tag is never purged.DELETE policy targeting tagState: UNTAGGED with an olderThan: 14d duration safely strips away old orphaned intermediate layers.DELETE policy targeting tagState: TAGGED, tagPrefixes: ["feat-"], and olderThan: 30d cleans up abandoned branch testing builds.KEEP policies always take precedence over DELETE policies, guaranteeing that artifacts matching retention rules will never be removed even if they match a deletion condition.tagState, tagPrefixes, versionNamePrefixes, olderThan, and newerThan.This design precisely separates retention guardrails (KEEP rules) from storage cleanup logic (DELETE rules). Because Artifact Registry evaluates all KEEP rules first, production images and recent rollbacks are guaranteed protection before any time-based deletion occurs.
This configuration attempts to encapsulate all retention, tag inspection, and age evaluation logic inside a single DELETE policy definition without specifying explicit KEEP policies.
KEEP policies removes the fundamental safety barrier in Artifact Registry. Without a KEEP policy for prod- tags, production images older than the deletion threshold risk permanent removal.keepCount (defined under mostRecentVersions) is exclusively an attribute of KEEP policies. It cannot be nested inside a DELETE policy condition.DELETE policy cannot enforce disparate retention durations (14 days for untagged images versus 30 days for feat- images) while simultaneously evaluating prefix matches.DELETE policies only accept duration conditions (olderThan, newerThan) and package/tag/version prefix filters.mostRecentVersions is only supported when action is set to KEEP.KEEP rules, any artifact matching a DELETE condition is permanently deleted.The repository used a single uniform expiration policy where every artifact without exception should be deleted after a fixed duration without needing tag-specific exemptions or minimum version count guarantees.
This approach attempts to use negative pattern matching and version indexing inside DELETE policies to emulate retention rules without declaring KEEP policies.
tagPrefixes or versionNamePrefixes.DELETE policies do not track ordered version index positions (e.g., indices 1–10). Version count preservation requires using mostRecentVersions.keepCount in a KEEP policy.DELETE policies violates the security principle of fail-safe defaults, creating a high probability of purging valid production images if a tag pattern deviates.tagPrefixes, versionNamePrefixes, packageNamePrefixes) use literal prefix strings, not arbitrary regular expressions.keepCount in KEEP actions.KEEP policies are intentionally designed to isolate preservation rules from purge rules.Artifact Registry supported POSIX regex negative lookaheads within standard deletion filters and lacked native KEEP policy structures.
This option builds a custom, script-based cleanup engine using Cloud Scheduler, Cloud Functions, and the Artifact Registry REST API / CLI to enumerate manifests and programmatically issue deletion calls.
artifactregistry.packages.delete IAM permissions to a custom service account.The organization required advanced business logic not supported by native policies, such as querying an external third-party metadata database or external ticket status before deleting an image.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated