构建配置文件架构

构建配置文件包含 Cloud Build 根据您的规范执行任务的说明。例如,您的构建配置文件可以包含构建、打包和推送 Docker 映像的说明。

本页面介绍了 Cloud Build 构建配置文件的架构。 如需了解如何创建和使用构建配置文件,请参阅创建基本的构建配置文件

构建配置文件的结构

构建配置文件使用 Cloud Build API 的 Build 资源进行建模。

您可以使用 YAML 或 JSON 语法编写构建配置文件。如果您使用第三方 http 工具(如 curl)提交构建请求,请使用 JSON 语法。

构建配置文件的结构如下:

YAML

steps:
- name: string
  args: [string, string, ...]
  env: [string, string, ...]
  allowFailure: boolean
  allowExitCodes: [string (int64 format), string (int64 format), ...]
  dir: string
  id: string
  waitFor: [string, string, ...]
  entrypoint: string
  secretEnv: string
  volumes: object(Volume)
  timeout: string (Duration format)
  script: string
  automapSubstitutions: boolean
  results: object(Results)
- name: string
  ...
- name: string
  ...
timeout: string (Duration format)
queueTtl: string (Duration format)
logsBucket: string
options:
 env: [string, string, ...]
 secretEnv: string
 volumes: object(Volume)
 sourceProvenanceHash: enum(HashType)
 machineType: enum(MachineType)
 diskSizeGb: string (int64 format)
 substitutionOption: enum(SubstitutionOption)
 dynamicSubstitutions: boolean
 automapSubstitutions: boolean
 logStreamingOption: enum(LogStreamingOption)
 logging: enum(LoggingMode)
 defaultLogsBucketBehavior: enum(DefaultLogsBucketBehavior)
 pool: object(PoolOption)
 pubsubTopic: string
 requestedVerifyOption: enum(RequestedVerifyOption)
substitutions: map (key: string, value: string)
tags: [string, string, ...]
serviceAccount: string
secrets: object(Secret)
availableSecrets: object(Secrets)
artifacts: object(Artifacts)
  goModules: [