如何使用在构建中注入的密码作为 Active Choices 参数中的环境变量如何使用、环境变量、参数、密码

2023-09-06 23:31:42 作者:骑猪追太阳

我在构建配置部分中定义了密码,标题为将密码作为环境变量注入构建":

I have passwords defined in the build configuration section titled "Inject passwords to the build as environment variables":

我想在我的 Active Choices 中使用 MYVAR(未加密值).不幸的是,它不起作用.对 MYVAR 的引用失败.

I want to use MYVAR (unencrypted value) in my Active Choices. Unfortunately, it's not working. The reference to MYVAR fails.

在下面的示例中,为了进行测试,我只是尝试显示 MYVAR 的值作为选择.您可以看到它失败了,而是使用了备用活动选择脚本.

In the example below, for testing, I am just trying to display the value of MYVAR as a choice. You can see it fails and the fallback active choices script is used instead.

最终,我想使用此变量对服务进行身份验证以构建选择列表,但我什至无法在我的脚本中引用它.我被卡住了.

Ultimately, I want to use this variable to authenticate to a service to build a list of choices but without being able to even reference it in my script. I'm stuck.

当我尝试使用参数构建"时:

When I try "build with parameters":

提前感谢您的帮助!

推荐答案

我认为这行不通.为什么?嗯,EnvInject 插件的 Build Environment 选项a> 阅读:

I think this is not going to work. Why? Well, the Build Environment options of the EnvInject Plugin read:

在构建过程中注入环境变量

将密码作为环境变量注入构建

当时 Active Choices 插件开始发挥作用构建尚未开始,因此尚未进行注入.

At the time the Active Choices Plugin comes into play the build hasn't started yet and hence the injection hasn't taken place.