Google Cloud Build 子构建
Google Cloud Build sub builds
每个子目录可以有多个 cloudbuild.yaml 文件吗?
例如:
my-app:
- service1
- cloudbuild.yaml
- service2
- cloudbuild.yaml
cloudbuild.yaml
是的,绝对是!您是否尝试从 my-app/cloudbuild.yaml 初始化 service1 和 service2 的构建?
使用 meta
配置初始化其他构建的示例:https://github.com/GoogleCloudPlatform/cloudbuild-integration-testing/blob/master/cloudbuild.meta.yaml
这里是 cloudbuild.meta.yaml
根据您的示例构建的:
steps:
- id: 'build service1'
name: 'gcr.io/cloud-builders/gcloud'
args: ['builds', 'submit', '--config service1/cloudbuild.yaml']
waitFor: ['-'] #start in parallel
- id: 'build service2'
name: 'gcr.io/cloud-builders/gcloud'
args: ['builds', 'submit', '--config service2/cloudbuild.yaml']
waitFor: ['-'] # start in parallel
答案基本正确。这将不起作用,因为您忘记包含“.”,它告诉您上传并构建当前目录。包含 sub/child cloudbuild.yaml 的正确方法是:
# Include cloudbuild sub step
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'builds'
- 'submit'
- '.'
- '--config'
- 'cloudbuild.yaml'
每个子目录可以有多个 cloudbuild.yaml 文件吗?
例如:
my-app:
- service1
- cloudbuild.yaml
- service2
- cloudbuild.yaml
cloudbuild.yaml
是的,绝对是!您是否尝试从 my-app/cloudbuild.yaml 初始化 service1 和 service2 的构建?
使用 meta
配置初始化其他构建的示例:https://github.com/GoogleCloudPlatform/cloudbuild-integration-testing/blob/master/cloudbuild.meta.yaml
这里是 cloudbuild.meta.yaml
根据您的示例构建的:
steps:
- id: 'build service1'
name: 'gcr.io/cloud-builders/gcloud'
args: ['builds', 'submit', '--config service1/cloudbuild.yaml']
waitFor: ['-'] #start in parallel
- id: 'build service2'
name: 'gcr.io/cloud-builders/gcloud'
args: ['builds', 'submit', '--config service2/cloudbuild.yaml']
waitFor: ['-'] # start in parallel
答案基本正确。这将不起作用,因为您忘记包含“.”,它告诉您上传并构建当前目录。包含 sub/child cloudbuild.yaml 的正确方法是:
# Include cloudbuild sub step
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'builds'
- 'submit'
- '.'
- '--config'
- 'cloudbuild.yaml'