DEV Community

Katie McLaughlin for Google Cloud

Posted on • Updated on

How to force an update to your Cloud Builders

ℹ️ The explicit problem space mentioned in this article may no longer be an issue, but the concepts and practical tips discussed may still help you in other ways ✨

With Cloud Run now in general availability, you can now update to your deployment scripts. No longer must you call gcloud beta run, now you can use just gcloud run!

... if you are running a version of gcloud, using at least Google Cloud SDK 271.0.0.

And if you've been running Cloud Build with --config, you might be using an older version.

When Cloud Build steps run, they often use Cloud Builders -- specially crafted docker containers. If you've already used one recently, it may be in your registry cache. This makes your builds faster (since it doesn't have to re-download the image), but it won't automatically get a new one if it exists.

To fix this, you'll have to specify the exact version of the image you want to use.

The information for the cloud builder in our case can be found by going to This automatically redirects us to a nice long view of the most recent image. This image updates nightly, so we can just grab the latest SHA and force our script to use that.

Google Cloud Console, image registry listing.
The image listing for, at time of writing

For the most recent image at time of writing, you'll need (known to their friends as 4ea77d19d733). Clicking the 'Copy full image name' icon will enter this in your clipboard, which you can then use to change your config script.

What we'll end up with is a step in our cloudbuild.yaml which looks something like this:

 - id: 'deploy service'
   name: ''
   args: ['run', 'deploy', '[SERVICE-NAME]', '--image', '$PROJECT_ID/[SERVICE-NAME]', '--region', '[REGION]','--platform', '[PLATFORM]']

You can always test the image by running a version check directly with Docker.

docker pull$SHA
docker run --rm$SHA --version

📝 Be sure to also gcloud components update to get the latest version of gcloud locally!

Top comments (0)