我们为旧版本的 Jenkins 编写的自定义插件使用 EnvironmentContributingAction 为执行提供环境变量,以便它们可以在未来的构建步骤中使用并作为参数传递给下游作业。
在尝试将我们的构建转换为工作流时,我无法访问这些变量:
node {
// this step queries an API and puts the results in
// environment variables called FE1|BE1_INTERNAL_ADDRESS
step([$class: 'SomeClass', parameter: foo])
// this ends up echoing 'null and null'
echo "${env.FE1_INTERNAL_ADDRESS} and ${env.BE1_INTERNAL_ADDRESS}"
}
有没有办法访问注入的环境变量?我是否必须将此功能转换为构建包装器?