[英]AWS CodeBuild - BuildSpec.yml - exported-variables are not resolving values
I am trying to export a variable value from the CodeBuild Stage of AWS code-pipeline but the value is not resolving我正在尝试从 AWS 代码管道的 CodeBuild Stage 导出变量值,但该值未解析
Note: Windows container's PowerShell is executing the commands of buildspec.yml注意:Windows容器的PowerShell正在执行buildspec.yml的命令
Example: I am setting an Input environment variable named Client like below in the AWS CodeBuild project示例:我正在 AWS CodeBuild 项目中设置一个名为 Client 的输入环境变量,如下所示
and to export the same value I have modified my buildspec.yml like below并导出相同的值我修改了我的 buildspec.yml 如下
version: 0.2版本:0.2
env:
variables:
ClientEnv: $(echo $Client)
exported-variables:
- ClientEnv
but the exported value is expression not the resolved value但导出的值是表达式而不是解析值
I have also tried passing variables but seems not working.我也试过传递变量但似乎不起作用。
How I can pass the environment variables to exported-variables in such a scenario在这种情况下我如何将环境变量传递给导出变量
Thanks in advance.提前致谢。
Simply use ${Client}
in your buildspec.yml file只需在 buildspec.yml 文件中使用${Client}
You need to change your code as is:您需要按原样更改代码:
env:
exported-variables:
- Client
If the name of the variable is Client as defined in the Env.如果变量的名称是 Env 中定义的 Client。 Vars of CodeBuild project thenthe following is enough. Vars of CodeBuild project 那么下面就够了。 You dont need to redefine the same variable in the env->variables section您不需要在env->variables部分重新定义相同的变量
env:
exported-variables:
- Client
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.