Jiew Meng
Jiew Meng

Reputation: 88317

CloudBuild Trigger: failed unmarshalling build config cloudbuild.yaml: json: cannot unmarshal string into Go value of type []json.RawMessage

When I use my cloudbuild.yaml with CloudBuild trigger, it fails with:

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

I already reduced my cloudbuild.yaml to

steps:
  - name: "gcr.io/skynet-2359/sonar-scanner"
    waitFor: "-"
    args: [
      "-Dsonar.projectKey=xxx",
      "-Dsonar.sources=./src",
      "-Dsonar.host.url=http://sonarqube....",
      "-Dsonar.login=${_SONAR_TOKEN}"
    ]

substitutions:
  _SONAR_TOKEN: "..."

The build works if I use the CLI way to start:

gcloud builds submit --config cloudbuild.yaml .

Upvotes: 4

Views: 5581

Answers (1)

Jiew Meng
Jiew Meng

Reputation: 88317

Found the issue. waitFor should be an array:

steps:
  - name: "gcr.io/skynet-2359/sonar-scanner"
    waitFor: ["-"]
    args: [
      "-Dsonar.projectKey=xxx",
      "-Dsonar.sources=./src",
      "-Dsonar.host.url=http://sonarqube....",
      "-Dsonar.login=${_SONAR_TOKEN}"
    ]

substitutions:
  _SONAR_TOKEN: "..."

Upvotes: 3

Related Questions