Where is set global limit for gcloud steps timeout for all builds?

泪湿孤枕 提交于 2021-02-10 23:08:14

问题


Where can I find global limit for gcloud build step timeout?

This is my gcloud build config:

steps:
  - name: 'gcr.io/cloud-builders/yarn'
  - name: 'gcr.io/cloud-builders/yarn'
    args: ['build-nginx-config']
  - name: 'gcr.io/cloud-builders/yarn'
    args: ['build']
    timeout: 3601s
  ...
timeout: 7200s

And this is what I get when I try to run this build:

[10:41:45]ERROR: (gcloud.builds.submit) INVALID_ARGUMENT: invalid build:
invalid timeout in build step #2:
build step timeout "1h0m1s" must be <= build timeout "1h0m0s"

So somewhere we have setup max for step timeout and I cannot find this place. Any advice?

UPD so it looks like build step timeout cannot be more than 1h.
But you can skip it completely and in this case step timeout is unlimited. The only limit remaining - is the overall build timeout limit.


回答1:


You can set the global timeout for your whole build execution by adding the timeout element at the root level of your cloudbuild.yaml file, like so:

steps:
  - name: 'gcr.io/cloud-builders/yarn'
  - name: 'gcr.io/cloud-builders/yarn'
    args: ['build-nginx-config']
  - name: 'gcr.io/cloud-builders/yarn'
    args: ['build']
    timeout: 3601s
  ...
timeout: 3602s // This value is > to your build step's timeout

The default value for the whole build timeout is 10min, as documented here. You can override this value by setting it explicitly in your file and set a value to up to 24h.

If you submit your build via the gcloud tool (which I see you do), the default timeout is set to 10min by default also there. You can override it by running:

gcloud config set builds/timeout 7200


来源:https://stackoverflow.com/questions/58299693/where-is-set-global-limit-for-gcloud-steps-timeout-for-all-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!