Jenkins transfer variable to other job



Goto JOB_1 and add a Post-Build action (Trigger parameterized build on other projects)

Type the project to build JOB_2


Add Parameters (Predefined Parameters)

Type the following in the Parameters box: test1=${test1}

Apply and Save

MOST IMPORTANT: YOU MUST ADD THIS PARAMETER (test1) to JOB_2

Goto and check "This build is parameterized" and add a "String Parameter"


Type "test1" (Must be same name) and put in a default value

It's now an environment variable, to access it, all you need is $test1

In your build step,

ie echo $test1  and it will display

登录后才可评论.