我跟踪了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部分下,简单地说日志不可用。
发布于 2019-04-22 21:50:02
objects.location元素不应该是数组。
下列措施应能发挥作用:
artifacts:
objects:
location: 'gs://my-bucket/artifacts/'
paths: ["build/libs/*.jar"]发布于 2018-09-08 17:10:43
您可能需要缩进objects:行
artifacts:
objects:
location: ['gs://my-bucket/artifacts/']
paths: ["build/libs/*.jar"]发布于 2018-11-28 17:15:24
我还遇到了这个错误,我的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")。
https://stackoverflow.com/questions/52080561
复制相似问题