Reputation: 13
I've followed the docs for Google CloudBuild here: https://cloud.google.com/cloud-build/docs/configuring-builds/store-images-artifacts
So here's my cloudbuild.yaml
configuration:
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"]
If I comment out, the following, then it runs successfully:
artifacts:
objects:
location: ['gs://my-bucket/artifacts/']
paths: ["build/libs/*.jar"]
Without comments, I get the following error from the CloudBuild console:
failed unmarshalling build config cloudbuild.yaml: json: cannot unmarshal array into Go value of type string
And under the Logs section, it simply says Logs unavailable.
Upvotes: 1
Views: 2581
Reputation: 281
objects.location
element should not be an array.
The following should work:
artifacts:
objects:
location: 'gs://my-bucket/artifacts/'
paths: ["build/libs/*.jar"]
Upvotes: 0
Reputation: 33861
I've also run into this error with a section of my cloudbuild.yaml file looking like:
- name: 'gcr.io/cloud-builders/git'
args:
- clone
- -depth
- 1
- --single-branch
- -b
- development
- [email protected]:aoaoeuoaeuoeaueu/oaeueoaueoauoaeuo.git
volumes:
- name: 'ssh'
path: /root/.ssh
Seems the issue is with the 1
. So I just added quotes around which fixed it (- "1"
).
Upvotes: 0
Reputation: 21
You may need to indent objects:
line
artifacts:
objects:
location: ['gs://my-bucket/artifacts/']
paths: ["build/libs/*.jar"]
Upvotes: 2