Google Cloud Build子版本

时间:2019-06-30 01:39:11

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

每个子目录可能有多个cloudbuild.yaml文件吗?

例如:

my-app:
  - service1
    - cloudbuild.yaml
  - service2
    - cloudbuild.yaml
  cloudbuild.yaml

2 个答案:

答案 0 :(得分:2)

是的,绝对可以!您是否正在尝试从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

答案 1 :(得分:1)

答案几乎是正确的。这将不起作用,因为您忘记了添加“。”,因为它告诉您上载和构建当前目录。包含子/子cloudbuild.yaml的正确方法是:

# Include cloudbuild sub step
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - 'builds'
  - 'submit'
  - '.'
  - '--config'
  - 'cloudbuild.yaml'