简体   繁体   中英

Jenkins : Passing a parameter from one job to another used Parameterized Trigger Plugin. Not Working

i have given as: in post build action's Parameterized Trigger Plugin

project to build : project B
Trigger when build is   : complete
Trigger build without paramater : disabled
in predefined param sections: 
Temp=${BUILD_NUMBER}
branch=$BRANCH
branch1="hai"

in project B 's Execute shell i have given as:

echo "Testing..." $Temp
echo $branch
echo $branch1

FYI, i have given BRANCH=development

console output of the Project B:

+ echo Testing...

Testing...

+ echo

+ echo

======

seems variable is not promoted.

Select the "Trigger/call builds on other projects" in build section instead of post build section.

In the Build Triggers,

Projects to build "project B"

"Select" Block until the triggered projects finish their builds Fail this build step if the triggered build is worse or equal to "Failure"
Mark this build as failure if the triggered build is worse or equal to "Failure"
Mark this build as unstable if the triggered build is worse or equal to "UNSTABLE"

In the predefined parameters,

Temp=${BUILD_NUMBER}

branch=$BRANCH

branch1="hai"

In your " project B " projects,

"Click the build is parameterized option "

And form the variable.

On the 2nd job on the General section tick the box "This project is parameterized" and define the name of the parameter you are passing form the 1st job. 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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