Why can't I override the timeout on my Google Cloud Build?

狂风中的少年 提交于 2020-06-27 18:42:28

问题


I am attempting to setup a CI Pipeline using Google Cloud Build.

I am attempting to deploy a MeteorJS app which has a lengthy build time - the default build timeout for GCB is 10 minutes and it was recommended here that I increase the timeout.

I have setup my cloudbuild.yaml file with the timeout option increased to 20 minutes:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy']
timeout: 1200s

I have a Trigger setup in GCB connected to a Bitbucket Repo and when I push a change and the Trigger fires, I get 2 new builds - one coming from Bitbucket and one whose source is Google Cloud Storage.

Once 10 minutes of build time has elapsed, the build from Cloud Storage will timeout which will cause the Bitbucket build to fail as well with Error Response: [4] DEADLINE_EXCEEDED

Occasionally, for whatever reason, the Cloud Storage build will finish in under 10 minutes which will allow the Bitbucket build to finish successfully and deploy.

If I attempt to cancel/stop the Cloud Storage build, it will also stop the Bitbucket build.

The screenshot below shows 2 attempts of the exact same build with differing results.

I do not understand where this second Cloud Storage Build is coming from, but it does not seem to be affected by the settings in my yaml file or my global GCP settings.

I have attempted to run the following commands from the gcloud CLI:

gcloud config set app/cloud_build_timeout 1200
gcloud config set builds/timeout 1200
gcloud config set container/build-timeout 1200

I have also attempted to use a high CPU build machine to speed up the process but it did not seem to have any effect.

Any insight would be greatly appreciated - I feel that I have exhausted every possible combination of Google Search keywords I can think up!


回答1:


This timeout error comes from app engine deployment itself which has 10 min timeout by default.

You will need to update app/cloud_build_timeout property inside container itself like this:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  entrypoint: 'bash'
  args: ['-c', 'gcloud config set app/cloud_build_timeout 1200 && gcloud app deploy']
timeout: 1200s

Update

Actually simpler solution:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy']
  timeout: 1200s
timeout: 1200s


来源:https://stackoverflow.com/questions/60070274/why-cant-i-override-the-timeout-on-my-google-cloud-build

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