【问题标题】:Why can't I override the timeout on my Google Cloud Build?为什么我不能覆盖我的 Google Cloud Build 的超时?
【发布时间】:2020-02-05 06:45:11
【问题描述】:

我正在尝试使用 Google Cloud Build 设置 CI 管道。

我正在尝试部署一个构建时间较长的 MeteorJS 应用程序 - GCB 的默认构建超时为 10 分钟,建议 here 我增加超时。

我已将cloudbuild.yaml 文件设置为timeout 选项增加到20 分钟:

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

我在 GCB 中有一个连接到 Bitbucket 存储库的触发器设置,当我推送更改并触发触发器时,我得到了 2 个新版本 - 一个来自 Bitbucket,一个来自 Google Cloud Storage

构建时间超过 10 分钟后,来自 Cloud Storage 的构建将超时,这将导致 Bitbucket 构建失败,Error Response: [4] DEADLINE_EXCEEDED

有时,无论出于何种原因,Cloud Storage 构建将在 10 分钟内完成,这将使 Bitbucket 构建成功完成并进行部署。

如果我尝试取消/停止 Cloud Storage 构建,它也会停止 Bitbucket 构建。

下面的屏幕截图显示了完全相同的构建的 2 次尝试,但结果不同。

我不明白第二个 Cloud Storage Build 来自哪里,但它似乎不受我的 yaml 文件中的设置或全局 GCP 设置的影响。

我已尝试从gcloud CLI 运行以下命令:

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

我也尝试使用高 CPU 构建机器来加速该过程,但它似乎没有任何效果。

任何见解都将不胜感激 - 我觉得我已经用尽了所有可能的 Google 搜索关键字组合!

【问题讨论】:

    标签: google-app-engine google-cloud-platform google-cloud-build


    【解决方案1】:

    此超时错误来自应用引擎部署本身,默认情况下有 10 分钟超时。

    您需要像这样更新容器内部的 app/cloud_build_timeout 属性:

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

    更新

    其实更简单solution:

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

    【讨论】:

    • 这似乎解决了 Cloud Storage 构建的问题 - 现在每次都能完成!
    • 但是,现在 Bitbucket 构建每次都失败并出现错误:INVALID_ARGUMENT: The following quotas were exceeded: CPUS (quota: 8, used: 6 + needed: 4). 知道为什么现在会发生这种情况吗?
    • 您达到了一些 CPU 配额限制。检查here 可能在计算引擎 API-> CPU 下。无论如何,我不明白为什么有 2 个版本正在运行。我尝试从 bitbucket 镜像简单的 repo,并在触发后只运行一个以 bitbucket 作为源的构建。我关注了this doc。您的 2 个构建最终看起来是否基本相同?您是否在 GAE 版本选项卡中连续部署了 2 次?
    • 这可能是因为您有 GCP 源存储库镜像 bitbucket 和类似的触发器。因此,当您推送到 bitcbucket 时,它会镜像到 GCP 存储库并且两个触发器都会关闭,一个以云存储作为源,另一个以 bitbucket 为源。这实在是太过分了,而且消耗了我认为的配额。
    • 再次感谢您回复我,Emil - 您认为这个云存储问题是使用 Bitbucket 的症状还是我可以做些什么来防止它发生?
    猜你喜欢
    • 2021-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-01
    • 1970-01-01
    • 2010-12-03
    相关资源
    最近更新 更多