Search code examples
jenkinsjenkins-pluginsjenkins-workflow

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.


Solution

  • 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.