本文介绍了云构建:“替代"部分中的替代项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终使用

options:
   env:

不太理想,因为不允许在构建步骤中使用变量,但涵盖了至少环境.

Not perfect since doesn't allow variable in build steps but atleast environments are covered.

GCP的 Cloud build 没有在 Substitutions 部分中替换变量.

GCP's Cloud build is not substituting variables in substitutions section.

有没有办法应用这些替代方法?

Is there a way to have those substitutions applied?

substitutions:
  _HUGO_VERSION: "0.55.6"
  _HUGO_IMG: gcr.io/$PROJECT_ID/hugo:$_HUGO_VERSION

期望

$ _ HUGO_VERSION $ PROJECT_ID 替换为值,以获得:

_HUGO_IMG=gcr.io/foo/hugo:0.55.6

实际

但是 _HUGO_IMG 的值实际上是采用的:

_HUGO_IMG=gcr.io/$PROJECT_ID/hugo:$_HUGO_VERSION

推荐答案

现在支持您的预期行为.请参阅文档:使用有效负载绑定和bash样式替换字符串操作

Your expected behavior is now supported. Please see the documentation:Using payload bindings and bash-style string operations in substitutions

options:
    dynamic_substitutions: true
substitutions:
    _HUGO_IMG: gcr.io/${PROJECT_ID}/hugo:${_HUGO_VERSION}

这篇关于云构建:“替代"部分中的替代项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 00:12