google cloud platform – Can’t replicate AWS ECR cleanup policy in GCP Artifact registry

We are migrating from the GCP Container registry to the Artifact registry.

During the migration, we want to apply the same AWS ECR cleanup policy we use in a different infrastructure but I can’t manage to figure out how to achieve it in GCP.

The cleanup policy should be as follows:

  • Branch policy = expire | sincelmagePushed (10 days) | tagged prefix [a]
  • Staging policy = expire | imageCountMoreThan (10) | tagged prefix [stag,dev]
  • Production policy = expire | imageCountMoreThan (10) | tagged prefix [prod, main, master, latest]
  • Catch all policy = expire | imageCountMoreThan (25) | any

Any idea on how can I achieve this?

Very important note: I can’t use the package prefix because I’m creating the repositories with Pulumi and inside each we usually store again the same package as the registry:

Eg. service-a/service-a/(Docker images)

But we also have some Registries that are more generic like infrastructure that can contain different packages

Eg.

infrastructure/
 - nginx/nginx-images
 - memcached/memcached-images
 - more packages...

Read more here: Source link