简体   繁体   English

Jenkins - 如何将环境变量从自由式作业传递到管道作业

[英]Jenkins - How to pass environmental variable from freestyle job to pipeline job

I have a freestyle job in Jenkins and would normally pass parameters to another freestyle job using the Predefined parameters option.我在Jenkins有一个自由式作业,通常会使用预定义参数选项将参数传递给另一个自由式作业。 example:例子:

PROJECT=Myproject
PATH=/depot/workspace/

Previously I could access the above values through the KEY in the downstream job through the environment by using ${PROJECT} OR ${PATH} .以前,我可以使用${PROJECT} OR ${PATH}通过环境通过下游作业中的 KEY 访问上述值。

My problem now is that I have a pipeline job that needs to access the above values but when using ${PROJECT} OR ${PATH} it does not work.我现在的问题是我有一个需要访问上述值的管道作业,但是在使用${PROJECT} OR ${PATH}时它不起作用。

So, in general how I want it to work is have the freestyle job run first and pass the parameters to the downstream pipeline job.所以,一般来说,我希望它的工作方式是先运行自由式作业并将参数传递给下游管道作业。

You might need to use "${params.PROJECT}" in your pipeline to access the parameters.您可能需要在管道中使用"${params.PROJECT}"来访问参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM