3

The Google Cloud Container Builder API documentation says that you are able to set the timeout through the API.

Our build are triggered by webhooks, meaning that the API is irellevant for us. Is there a way to set the build timeout on automatically triggered builds?

Hedam
  • 183
  • 2
  • 8

2 Answers2

5

For build triggers, you can specify the same parameters as a build resource in your cloudbuild.yaml, which includes the timeout parameter. For example:

steps:
- name: 'ubuntu'
  args: ['./binary', 'rawdata.tgz']

timeout: 1200s
Adam
  • 798
  • 3
  • 11
  • I'm getting ```ERROR: gcloud crashed (InvalidBuildError): Field [timeout] was provided, but should not have been. You may be using an improper Cloud Build pipeline.``` Hints appreciated! – icarito Mar 23 '19 at 07:11
  • If anyone encounters what I did, I finally could move on removing this from the cloudbuild.yaml and instead configuring it with the gcloud command:`gcloud config set app/cloud_build_timeout 1200` – icarito Mar 24 '19 at 02:10
1

There are two places to put the time out in the yaml file.....

  1. In the build step which is set as a max of 10 minutes by the system
  2. In the file which controls the overall build time of the whole file.

The line indent controls this.

No indent then Timeout: 1200s is possible

Build Step indent then max Timeout: 10m0s

Eggely
  • 11
  • 1
  • I get `Your build failed to run: failed unmarshalling build config cloudbuild.yaml: unknown field "timout" in google.devtools.cloudbuild.v1.Build` unless I have the `timeout` field nested in one of the build steps. – threed May 20 '20 at 18:58