Cloud Build 位置

Cloud Build 支持在专用池默认池中进行区域性构建。

为 build 选择区域时,应主要考虑延迟时间和可用性。通常,您可以选择离您的 Cloud Build 用户最近的区域,但除此之外,您还应该考虑您的构建可能会集成的其他 Google Cloud 产品和服务的位置。跨多个位置使用服务可能会影响应用的延迟时间和价格

Cloud Build 可在以下区域使用:

  • africa-south1
  • asia-east1
  • asia-east2
  • asia-northeast1
  • asia-northeast2
  • asia-northeast3
  • asia-south1
  • asia-south2
  • asia-southeast1
  • asia-southeast2
  • australia-southeast1
  • australia-southeast2
  • europe-central2
  • europe-north1
  • europe-north2
  • europe-southwest1
  • europe-west1
  • europe-west2
  • europe-west3
  • europe-west4
  • europe-west6
  • europe-west8
  • europe-west9
  • europe-west10
  • europe-west12
  • me-central1
  • me-central2
  • me-west1
  • northamerica-northeast1
  • northamerica-northeast2
  • northamerica-south1
  • southamerica-east1
  • southamerica-west1
  • us-central1
  • us-east1
  • us-east4
  • us-east5
  • us-south1
  • us-west1
  • us-west2
  • us-west3
  • us-west4

选择区域

如需运行地区性 build,请在通过命令行启动 build创建 build 触发器时指定区域。

如需为专用池选择区域,请在创建专用池时指定区域。在一个区域内创建专用池后,您无法将其移动到另一个区域。当您在特定区域中创建专用池时,专用池将由 Google 代管,在该区域内的所有可用区以冗余方式提供。

如果与触发器关联的构建配置文件指定了专用池,则您为触发器选择的区域必须与专用池的区域一致。

如果您选择 global 作为构建触发器的区域,则 Cloud Build 会使用与触发器关联的构建配置文件中指定的区域来运行构建。如果您在构建配置文件中指定了专用池,则此字段可以是专用池的区域;如果您未指定专用池,则此字段可以是全局默认池。

使用区域端点访问 Cloud Build 资源

您可以使用区域端点访问 Cloud Build 中的资源。使用区域端点,您可以根据符合数据驻留和数据主权要求的方式运行工作负载,其中请求流量会直接路由到端点中指定的区域。

区域端点是请求端点,只有在受影响的资源存在于端点指定的位置时,才允许请求继续。例如,当您在创建 build 请求中使用端点 https://cloudBuild.me-central2.rep.googleapis.com 时,仅当 build 配置文件位于 me-central2 中时,请求才会继续。

与全球端点不同(全球端点可在不同于资源所在位置的其他位置处理请求),区域端点可保证您的请求仅在端点指定的位置(即资源所在的位置)进行处理。对于从互联网收到的请求、其他Google Cloud 资源(例如 Compute Engine 虚拟机)、使用 VPN 或 Interconnect 的本地服务和 Virtual Private Cloud (VPC),区域端点在端点指定的位置终止 TLS 会话。

区域端点通过确保对象的静态数据和传输中数据不会移出端点指定的位置,保证数据驻留。此保证不包括资源元数据,例如对象名称和存储桶 IAM 政策。如需了解详情,请参阅有关客户数据和服务数据的说明

如需了解运行 build 所需的步骤,请参阅运行 build

配置 Google Cloud CLI 以与区域端点搭配使用

如需配置 gcloud CLI 以与区域端点搭配使用,请执行以下操作:

  1. 确保您使用的是 Google Cloud CLI 402.0.0 或更高版本。

  2. api_endpoint_overrides/cloudbuild 属性设置为您要使用的区域端点:

    gcloud config set api_endpoint_overrides/cloudbuild https://cloudbuild.LOCATION.rep.googleapis.com/

    或者,您可以将 CLOUDSDK_API_ENDPOINT_OVERRIDES_CLOUDBUILD 环境变量设置为端点:

    CLOUDSDK_API_ENDPOINT_OVERRIDES_CLOUDBUILD=https://cloudbuild.LOCATION.rep.googleapis.com/ 

某些项目的受限区域

根据使用情况,某些项目可能仅限在以下区域使用 Cloud Build:

  • us-central1
  • us-west2
  • europe-west1
  • asia-east1
  • australia-southeast1
  • southamerica-east1