我在Google云构建中遇到以下错误
Failed to trigger build: failed unmarshalling build config cloudbuild.yaml: yaml: line 12: could not find expected ':'
我无法在我的:
文件中查明我到底在哪里丢失cloudbuild.yaml
steps:
# Install
- name: "gcr.io/cloud-builders/npm"
args: ["install"]
# Update submodules
- name: "gcr.io/cloud-builders/git"
entrypoint: "bash"
args:
- "-c"
- |
git config -f .gitmodules submodule.myprojectsubmodule.url https://source.developers.google.com/p/myproject/r/github_myprojectsubmodule
git submodule init
git submodule update
# Lint
- name: "gcr.io/cloud-builders/npm"
args: ["run", "lint"]
# Test
- name: "gcr.io/cloud-builders/npm"
args: ["run", "test"]
# Build
- name: "gcr.io/cloud-builders/gcloud"
args:
- kms
- decrypt
- --ciphertext-file=.env.enc
- --plaintext-file=.env
- --location=global
- --keyring=myproject
- --key=cloudbuild-env
- name: "gcr.io/cloud-builders/npm"
args: ["run", "build"]
# Deploy
- name: "gcr.io/cloud-builders/npm"
args: ["run", "deploy"]
我使用以下评论https://github.com/GoogleCloudPlatform/cloud-builders/issues/26#issuecomment-463465138添加了# Update submodules
步骤
答案 0 :(得分:1)
要成为有效的yaml
格式,请在更新子模块部分的git
符号下正确对齐|
命令。
# Update submodules
- name: "gcr.io/cloud-builders/git"
entrypoint: "bash"
args:
- "-c"
- |
git config -f .gitmodules submodule.myprojectsubmodule.url https://source.developers.google.com/p/myproject/r/github_myprojectsubmodule
git submodule init
git submodule update
在这种情况下,YAML验证器可能很有用,例如https://codebeautify.org/yaml-validator。