如何在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.
答案 0 :(得分:0)
我最终找到了解决方法
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- '-c'
- |
version=$TAG_NAME
gcloud app deploy --version=${version//./-}
entrypoint: bash