【问题标题】:CloudBuild Trigger: failed unmarshalling build config cloudbuild.yaml: json: cannot unmarshal string into Go value of type []json.RawMessageCloudBuild 触发器:解组构建配置 cloudbuild.yaml 失败:json:无法将字符串解组为 []json.RawMessage 类型的 Go 值
【发布时间】:2020-04-01 15:47:59
【问题描述】:

当我将 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 .

【问题讨论】:

  • 你检查过这个帖子吗?似乎正在讨论一个类似的问题,它没有解释为什么它在本地成功但可能值得检查您的声纳令牌大小:stackoverflow.com/questions/51539273/…
  • @ParthMehta 发现了问题。我的是因为我没有使用数组来等待

标签: google-cloud-platform google-cloud-build


【解决方案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: "..."

【讨论】:

    猜你喜欢
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 2021-05-20
    • 1970-01-01
    • 2014-02-04
    • 2018-08-19
    • 1970-01-01
    • 2021-03-05
    相关资源
    最近更新 更多