1

我在这里关注了 Google CloudBuild 的文档:https ://cloud.google.com/cloud-build/docs/configuring-builds/store-images-artifacts

所以这是我的cloudbuild.yaml配置:

steps:
- name: gcr.io/cloud-builders/git
id: git-checkout
args: [ 'fetch','--tags','--unshallow']
- name: openjdk
id: gradle-build
args: [
    './gradlew',
    '--build-cache',
    '-Si',
    '-Panalytics.buildId=$BUILD_ID',
    '-PgithubToken=$_GITHUB_TOKEN',
    '-g', '$_GRADLE_CACHE',
    'build'
]
artifacts:
objects:
    location: ['gs://my-bucket/artifacts/']
    paths: ["build/libs/*.jar"]

如果我注释掉以下内容,则它会成功运行:

artifacts:
objects:
    location: ['gs://my-bucket/artifacts/']
    paths: ["build/libs/*.jar"]

如果没有注释,我会从 CloudBuild 控制台收到以下错误:

failed unmarshalling build config cloudbuild.yaml: json: cannot unmarshal array into Go value of type string

Logs部分下,它只是说Logs available

4

3 回答 3

2

您可能需要缩objects:进行

artifacts:
  objects:
    location: ['gs://my-bucket/artifacts/']
    paths: ["build/libs/*.jar"]
于 2018-09-08T17:10:43.463 回答
0

我的 cloudbuild.yaml 文件的一部分也遇到了这个错误,如下所示:

- name: 'gcr.io/cloud-builders/git'
  args:
  - clone 
  - -depth
  - 1
  - --single-branch
  - -b
  - development
  - git@bitbucket.org:aoaoeuoaeuoeaueu/oaeueoaueoauoaeuo.git
  volumes:
  - name: 'ssh'
    path: /root/.ssh

似乎问题出在1. 所以我只是添加了固定它的引号(- "1")。

于 2018-11-28T17:15:24.437 回答
0

objects.location元素不应该是一个数组。

以下应该有效:

artifacts:
  objects:
    location: 'gs://my-bucket/artifacts/'
    paths: ["build/libs/*.jar"]
于 2019-04-22T21:50:02.327 回答