Search code examples
jenkinscontinuous-integrationjenkins-pluginsjenkins-cli

How to be parameterized that 2 projects which is "Build after other projects are built"


I have a problem and I'm looking for a direct solution or a workaround.

I have 2 jobs on Jenkins: job A (the upstream job) and job B (the downstream job) that needs to be triggered after job A has finished

I used to solve this problem with: "This project is parameterized" set on job A,B and it worked perfectly fine. but on job B it does not work. When I build with parameter job A, jenkins wants a parameter for job A and then triggering Job B. job B needs a new parameter. Jenkins does not want new parameter for job B. I need to give paramateres both projects. Is there any solution ?


Solution

  • Let's say you need to pass PARAM1 and PARAM2 to JOB B.

    Declare PARAM1 and PARAM2 in JOB A, then pass both the parameters to JOB B in the post build action in Trigger Parameterized Job like this:

    param1 = $PARAM1

    param2 = $PARAM2

    Then in JOB B declare param1 and param2.

    This should do the trick.