如何在云存储中单独保存最新版本的 cloudbuild.yaml
How to keep latest version of cloudbuild.yaml seperate in the cloud storage
我的 cloudbuild.yaml
包括:
steps:
- name: maven:3.6.0-jdk-8-slim
entrypoint: 'mvn'
args: ["clean","install","-PgenericApiSuite","-pl", "api-testing", "-am", "-B"]
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', '/workspace/api-testing/target/cucumber-html-reports', 'gs://testing-reports/$BUILD_ID']
但现在每次运行时,我的存储桶都会显示带有 build_id
的报告。
有什么方法可以将最新报告与其他报告分开?
遗憾的是,云存储中不存在符号 link。为了实现你想要的,你必须在工作结束时通过以下 2 个步骤手动处理:
# delete the previous existing latest directory
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'rm', '-r', 'gs://testing-reports/latest']
# copy the most recent file into the latest directory
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'gs://testing-reports/$BUILD_ID', 'gs://testing-reports/latest']
我的 cloudbuild.yaml
包括:
steps:
- name: maven:3.6.0-jdk-8-slim
entrypoint: 'mvn'
args: ["clean","install","-PgenericApiSuite","-pl", "api-testing", "-am", "-B"]
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', '/workspace/api-testing/target/cucumber-html-reports', 'gs://testing-reports/$BUILD_ID']
但现在每次运行时,我的存储桶都会显示带有 build_id
的报告。
有什么方法可以将最新报告与其他报告分开?
遗憾的是,云存储中不存在符号 link。为了实现你想要的,你必须在工作结束时通过以下 2 个步骤手动处理:
# delete the previous existing latest directory
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'rm', '-r', 'gs://testing-reports/latest']
# copy the most recent file into the latest directory
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'gs://testing-reports/$BUILD_ID', 'gs://testing-reports/latest']