如何替换 cloudbuild.yaml 中的替换字符串
how to replace substitute string in cloudbuild.yaml
如何替换 cloudbuild.yaml 中的替换字符串?
我想使用 cloudbuild 将 appengine 版本设置为 $TAG_NAME。由于该版本只接受连字符,我需要先将点替换为连字符。
我试过了:
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', '--no-promote', "--version=$(echo $TAG_NAME | sed 's/[.]/-/g')"]
timeout: '1600s'
但是得到了
ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [$(echo 0.0.1a4 | sed 's/[.]/-/g')]: May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
我找到了解决方案
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- '-c'
- |
version=$TAG_NAME
gcloud app deploy --version=${version//./-}
entrypoint: bash
如何替换 cloudbuild.yaml 中的替换字符串?
我想使用 cloudbuild 将 appengine 版本设置为 $TAG_NAME。由于该版本只接受连字符,我需要先将点替换为连字符。
我试过了:
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', '--no-promote', "--version=$(echo $TAG_NAME | sed 's/[.]/-/g')"]
timeout: '1600s'
但是得到了
ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [$(echo 0.0.1a4 | sed 's/[.]/-/g')]: May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
我找到了解决方案
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- '-c'
- |
version=$TAG_NAME
gcloud app deploy --version=${version//./-}
entrypoint: bash