48

I have a Google Cloud Build build that times out after 10 min, 3 sec. Is there a way to extend that timeout?

The build status is set to "Build failed (timeout)" and I'm okay with it taking longer than 10 minutes.

Suhas Chikkanna
  • 1,292
  • 5
  • 20
  • 34
munchybunch
  • 6,033
  • 11
  • 48
  • 62

2 Answers2

57

In cloudbuild.yaml you have to add something like timeout: 660s.

E.g.

steps:
- name: 'gcr.io/cloud-builders/docker'
  args: [ 'build', '-t', 'gcr.io/[PRODUCT_ID]/[CONTAINER_IMAGE]', '.' ]
images: 
- 'gcr.io/[PRODUCT_ID]/[CONTAINER_IMAGE]'
timeout: 660s
Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
Paul Lewallen
  • 691
  • 6
  • 7
  • 1
    Here is the documentation (https://cloud.google.com/cloud-build/docs/build-config#timeout_2). If you peruse that page you can see that you can set a global timeout or also a timeout for just a single step: _Use the timeout field in a build step to set a time limit for executing the step. If you don't set this field, the step has no time limit and will be allowed to run until either it completes or the build itself times out. The timeout field in a build step must not exceed the timeout value specified for a build._ – Stephen Feb 04 '21 at 18:13
34

If you defined your build using a cloudbuild.yaml, you can just set the timeout field; see the full definition of a Build Resource in the documentation.

If you are using the gcloud CLI, it takes a --timeout flag; try gcloud builds submit --help for details.

Example: gcloud builds submit --timeout=900s ...

Community
  • 1
  • 1
David Bendory
  • 1,258
  • 8
  • 14
  • 1
    One hour example: gcloud builds submit --tag gcr.io/[PROJECTID]/helloworld --timeout=3600 – Emre Apr 07 '20 at 19:15
  • 1
    @EmreSülün As seen in the link provided in the answer: `A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".` I think you should have an s after 3600 or it will use the default instead. I could easily be wrong about this. – Daniel Mar 03 '22 at 02:17