Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 .
like image 266
Jiew Meng Avatar asked Oct 16 '25 14:10

Jiew Meng


1 Answers

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: "..."
like image 198
Jiew Meng Avatar answered Oct 18 '25 15:10

Jiew Meng