如何在GCP存储中上传文件夹。

huangapple go评论65阅读模式
英文:

how to upload folder in artifacts GCP storage

问题

如何上传文件夹至构件中:

我的 cloudbuild.yaml 中的代码:

artifacts:
  objects:
    location: 'REDACTED'
    paths: ['REDACTED']
英文:

How to upload folder in artifacts:

My code in cloudbuild.yaml:

artifacts:
  objects:   
    location: 'REDACTED'
    paths: ['REDACTED']

答案1

得分: 0

你已经走在正确的轨道上。根据文档

定义你的_YAML_构建配置文件。

artifacts:
  objects:
    location: [STORAGE_LOCATION]
    paths: [[ARTIFACT_PATH],[ARTIFACT_PATH], ...]

其中,

  • [STORAGE_LOCATION]:Cloud Build必须存储工件的Cloud Storage存储桶或存储桶内的文件夹,例如 gs://mybucket 或 gs://mybucket/some/folder。
  • [ARTIFACT_PATH]:一个或多个工件的路径。

然后,您需要使用适当的值替换方括号[]中的值。参见上传文件和文件夹的示例

一旦您的构建成功完成,您可以在位于 [STORAGE_LOCATION]/artifacts-$BUILD_ID.json` 的 JSON 清单文件中找到上传结果。


编辑

截至今天,文档指出了以下内容:

  1. 您只能指定一个用于上传工件的存储桶,并且您必须是该存储桶的所有者。

  2. 您可以指定存储桶中的有效目录路径。

  3. 您可以上传任意数量的工件,但只能指定多达一百个工件路径。

已经为指定多个存储桶位置创建了一个功能请求,您可以通过问题跟踪器进行关注。

英文:

You are on the right track. From the documentation:

Define your YAML build configuration file.

artifacts:
  objects:
    location: [STORAGE_LOCATION]
    paths: [[ARTIFACT_PATH],[ARTIFACT_PATH], ...]

Where,

  • [STORAGE_LOCATION]: A Cloud Storage bucket or a folder within the bucket where Cloud Build must store the artifact, such as gs://mybucket or gs://mybucket/some/folder.
  • [ARTIFACT_PATH]: Path to one or more artifacts.

Then, you will need to replace the values in brackets [] with the appropriate values. See example for uploading files and folders.

Once your build completes successfully, you can find the upload results in the JSON manifest file located at [STORAGE_LOCATION]/artifacts-$BUILD_ID.json`.


Edited

As of today, the documentation points out the following:

  1. You can specify only one bucket to upload the artifacts and you must be the owner of the bucket.

  2. You can specify a valid directory path in the bucket.

  3. You can upload any number of artifacts, but you can specify only up to one hundred artifact paths.

There is already a feature request created for specifying multiple bucket locations that you can follow via Issue Tracker.

huangapple
  • 本文由 发表于 2020年9月8日 19:13:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/63792732.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定