【问题标题】:How to keep latest version of cloudbuild.yaml seperate in the cloud storage如何将最新版本的 cloudbuild.yaml 单独保存在云存储中
【发布时间】:2019-12-10 11:55:19
【问题描述】:

我的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 的报告。

有什么方法可以让我将最新报告与其他报告区分开来?

【问题讨论】:

  • “分离”是什么意思?在旧报告之外的另一个存储桶中?
  • 不,我的意思是作为识别最新报告的一种方式。如果我创建一个“最新”的新文件夹并部署我的构建,则文件夹中的旧报告不会被覆盖。所以我不知道如何将最新报告放在单独的文件夹中。
  • 您希望生成的存储桶是什么样的?他最新报告的“名称”应该是什么?在报告文件名中包含数据/时间怎么样?
  • 是的,这正是我想要的,我的存储桶现在看起来像这样:imgur.com/mITJxS1 文件夹的名称是 BUILD_ID,但我想要一个文件夹 /latest 只存储最新报告。如果我将目录更改为 /latest,则此文件夹中的文件不会被覆盖,因此它仍然是旧报告。添加时间戳是一个不错的可视化解决方案,但最终我想自动使用最新报告来创建静态网站
  • 所以我想参考那个文件夹

标签: google-app-engine pipeline google-cloud-build


【解决方案1】:

遗憾的是,云存储中不存在符号链接。为了实现您想要的,您必须在工作结束时通过以下两个步骤手动处理:

# 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']

【讨论】:

    猜你喜欢
    • 2019-12-11
    • 2017-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多