Cloud Build 在卡在排队中的工作池中构建

Cloud Build builds in worker pools stuck in Queued

我们正在使用 Google Cloud Build 作为 CI/CD 工具,我们使用私有池来使用私有 IP 连接到我们的数据库。

自 08 月 27 日以来,我们使用私有池的构建卡在 Queued 中,并且永远不会执行或因超时而失败,它们只是挂在那里,直到我们取消它们。

我们已经尝试过没有成功:

删除工作池配置(运行 全局构建)执行构建。

cloudbuild.yaml:

steps:
  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    id: Backup database
    args: ['gcloud', 'sql', 'backups', 'create', '--instance=${_DATABASE_INSTANCE_NAME}']

  - name: 'node:14.17.4-slim'
    id: Migrate database
    entrypoint: npm
    dir: 'build'
    args: ['...']
    secretEnv: ['DATABASE_URL']

  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    id: Migrate traffic to new version
    dir: 'build'
    entrypoint: bash
    args: ['-c', 'gcloud app services set-traffic ${_SERVICE_NAME} --splits ${_VERSION_NAME}=1']

availableSecrets:
  secretManager:
    - versionName: '${_DATABASE_URL_SECRET}'
      env: 'DATABASE_URL'

options:
  pool:
    name: 'projects/$PROJECT_ID/locations/southamerica-east1/workerPools/<project-id>'

我们的工作人员池配置:

$ gcloud builds worker-pools describe <worker-pool-id> --region=southamerica-east1 --project=<project-id>

createTime: '2021-08-30T19:35:57.833710523Z'
etag: W/"..."
name: <worker-pool-id>
privatePoolV1Config:
  networkConfig:
    egressOption: PUBLIC_EGRESS
    peeredNetwork: projects/<project-id>/global/networks/default
  workerConfig:
    diskSizeGb: '1000'
    machineType: e2-medium
state: RUNNING
uid: ...
updateTime: '2021-08-30T20:14:13.918712802Z'

构建队列状态可能有以下可能原因:

  1. Concurrency limits. Cloud Build enforces quotas on running builds for various reasons. As a default, Cloud Build has only 10 concurrent build limit, whilst as per Worker Pool, it has a 30 concurrent build limit. You can also further check in this link 配额限制。

  2. Using a custom machine size。除了标准机器类型外,Cloud Build 还为 运行 您的构建提供四种高 CPU 虚拟机类型。

  3. 您正在使用 worker pools alpha 并且可用节点太少。

此外,如果问题仍然存在,您可以在 Google Cloud 下提交错误。我看到您的同事已经在此 link 中提交了 public 问题跟踪器。此外,如果您有免费试用或付费支持计划,最好使用它来提交问题。

这是我上周与 Cloud Build PM 的讨论...TL;DR:如果您不支持订阅或公司帐户,则不能(目前)

具体可以查看RJC的1. link,你会得到

如果你仔细观察,你可以看到(使用我的个人帐户,即使我有一个组织结构)每个工作池的并发构建数设置为 0。这就是你的无限队列的原因构建作业。

最烦人的部分是这个。单击每个工作池行的并发构建复选框,然后单击编辑以更改限制。在这里你得到什么

仔细阅读:在 0 和 0 之间设置一个限制。

因此,如果您不支持订阅(像我一样),则无法通过您的个人帐户使用该功能。 我能够通过我的公司帐户使用它,即使我不应该...

目前,我没有解决方案,只有来自 PM 的最新消息

The behaviour around quota restrictions in private pools is a recent change that we're still iterating on and appreciate the feedback to make it easier for personal accounts to try out the feature.