How to delete all but the latest revision of Google cloud run container images?

ua flag

I am hosting my containerized application using Google cloud run. To save cost, I want to delete all but the active revisions of my application's Docker image.

I use a job of my GitLab pipeline to handle the credentials and settings using environment variables.

I can list my revisions like so:

gcloud run revisions list --region="$GCP_REGION"
ua flag

The latest revision of your application is the only one active. Exploiting that fact, we can delete all other revisions:

gcloud run revisions list --filter="status.conditions.type:Active AND status.conditions.status:'False'" --format='value(' | xargs -r -L1 gcloud run revisions delete --quiet


I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.