当我将cloudbuild.yaml
与CloudBuild触发器一起使用时,它失败并显示:
failed unmarshalling build config cloudbuild.yaml: json: cannot unmarshal string into Go value of type []json.RawMessage
我已经将自己的cloudbuild.yaml减小为
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: "..."
如果我使用CLI方式开始构建,则构建工作正常:
gcloud builds submit --config cloudbuild.yaml .
答案 0 :(得分:1)
发现了问题。 waitFor
应该是一个数组:
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: "..."