Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Retry a failed cloud build job automatically

tdh
Bronze 1
Bronze 1

Is it possible to retry a failed cloud build job automatically? 

Solved Solved
0 1 1,912
1 ACCEPTED SOLUTION

I believe you can do the following:

You could "Automating builds using build triggers" [1] and trigger a build upon failure by creating a commit on another branch or with a tag.

You could "Create Custom Build Steps" [2] that could read a failure and retry the build [3]

Perhaps the simplest option is to create "Build Notifications" [4] to alert you upon failures to do a manual build retry.

And finally, I found this article [5] which you can use Cloud Build > Pub/Sub > Cloud Functions in an event of failure. 

 

[1] https://cloud.google.com/cloud-build/docs/running-builds/automate-builds

[2] https://cloud.google.com/cloud-build/docs/create-custom-build-steps

[3] https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds/retry

[4] https://cloud.google.com/cloud-build/docs/send-build-notifications

[5] https://www.toptal.com/devops/better-google-cloud-continuous-deployment

View solution in original post

1 REPLY 1

I believe you can do the following:

You could "Automating builds using build triggers" [1] and trigger a build upon failure by creating a commit on another branch or with a tag.

You could "Create Custom Build Steps" [2] that could read a failure and retry the build [3]

Perhaps the simplest option is to create "Build Notifications" [4] to alert you upon failures to do a manual build retry.

And finally, I found this article [5] which you can use Cloud Build > Pub/Sub > Cloud Functions in an event of failure. 

 

[1] https://cloud.google.com/cloud-build/docs/running-builds/automate-builds

[2] https://cloud.google.com/cloud-build/docs/create-custom-build-steps

[3] https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds/retry

[4] https://cloud.google.com/cloud-build/docs/send-build-notifications

[5] https://www.toptal.com/devops/better-google-cloud-continuous-deployment