0

我有一个 GCP 云构建 yaml 文件,它在 Github 中的新标签上触发。

我已将最新标签配置为在应用程序引擎版本上显示,但我需要配置 cloudbuild.yml 文件以将我的标签上的句号替换为连字符,否则它在部署阶段会失败。

  - id: web:set-env
    name: 'gcr.io/cloud-builders/gcloud'
    env:
      - "VERSION=${TAG_NAME}"
      
  #Deploy to google cloud app engine
  - id: web:deploy
    dir: "."
    name: "gcr.io/cloud-builders/gcloud"
    waitFor: ['web:build']
    args:
      [
        'app',
        'deploy',
        'app.web.yaml',
        "--version=${TAG_NAME}",
        --no-promote,
      ]

尝试使用--version=${TAG_NAME//./-},但在部署阶段出错。

4

1 回答 1

1

通过使用 cloudbuild.yml 文件中的以下步骤,设法将 te fullstop 替换为 n 连字符:

  - id: tag:release
        name: 'gcr.io/cloud-builders/gcloud'
        args:
        - '-c'
        - |
          version=$TAG_NAME
          gcloud app deploy app.web.yaml --version=${version//./-} --no-promote
        entrypoint: bash
于 2021-11-23T08:49:16.940 回答