Create a Docker-format repository in Google Artifact Registry and configure cleanup policies to delete untagged images older than 30 days via gcloud and the REST API
Create the repository using gcloud artifacts repositories create <REPO_NAME> --repository-format=docker --location=<REGION> --project=<PROJECT_ID>, or POST to https://artifactregistry.googleapis.com/v1/projects/<PROJECT>/locations/<REGION>/repositories with format: DOCKER in the request body
Authenticate with an identity that has the roles/artifactregistry.admin IAM role on the project, and obtain an OAuth2 bearer token with scope https://www.googleapis.com/auth/cloud-platform
Define a cleanup policy JSON object with condition.tagState: UNTAGGED and condition.olderThan duration (e.g., 2592000s for 30 days) along with an action of DELETE
Apply the cleanup policy to the repository by PATCHing https://artifactregistry.googleapis.com/v1/projects/<PROJECT>/locations/<REGION>/repositories/<REPO_NAME> with the cleanupPolicies field in the request body
Verify with GET on the same repository resource and confirm the cleanupPolicies array is populated; test dry-run behavior by enabling cleanupPolicyDryRun on the repository before activating deletion
Known gotchas
Artifact Registry cleanup policies are evaluated periodically by Google's backend, not instantly; a newly applied policy does not immediately delete matching images
The cleanupPolicies field on the repository resource uses duration strings in seconds (e.g., '2592000s'); using plain integers or ISO-8601 durations will cause validation errors
If both keep and delete policies are defined on the same repository, keep policies take precedence over delete policies regardless of order
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp