Google 云构建意外字符:在 cloudbuild.yaml
Google cloud build unexpected char : in cloudbuild.yaml
我在 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"]
我使用以下评论添加了 # Update submodules
步骤 https://github.com/GoogleCloudPlatform/cloud-builders/issues/26#issuecomment-463465138
要成为有效的 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。
我在 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"]
我使用以下评论添加了 # Update submodules
步骤 https://github.com/GoogleCloudPlatform/cloud-builders/issues/26#issuecomment-463465138
要成为有效的 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。