Professional Cloud DevOps Engineer
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.
Last updated
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?
Create a Cloud Scheduler job targeting Cloud Functions to query the Artifact Registry API every night and execute gcloud artifacts docker images delete for non-matching tags.
Define four DELETE policies with negative regex match patterns that explicitly exclude tagPrefixes prod-* and version indices 1 through 10.
Define a single DELETE policy with multiple condition blocks combining tagState ANY, keepCount 10, and olderThan 30d, while omitting any KEEP policies.
Define two KEEP policies (one with mostRecentVersions keepCount set to 10, and one with tagState TAGGED and tagPrefixes ["prod-"]) and two DELETE policies (one with tagState UNTAGGED and olderThan 14d, and one with tagState TAGGED, tagPrefixes ["feat-"], and olderThan 30d).
Create a Cloud Scheduler job targeting Cloud Functions to query the Artifact Registry API every night and execute gcloud artifacts docker images delete for non-matching tags.
Define four DELETE policies with negative regex match patterns that explicitly exclude tagPrefixes prod-* and version indices 1 through 10.
Define a single DELETE policy with multiple condition blocks combining tagState ANY, keepCount 10, and olderThan 30d, while omitting any KEEP policies.
Define two KEEP policies (one with mostRecentVersions keepCount set to 10, and one with tagState TAGGED and tagPrefixes ["prod-"]) and two DELETE policies (one with tagState UNTAGGED and olderThan 14d, and one with tagState TAGGED, tagPrefixes ["feat-"], and olderThan 30d).
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.