Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 745
mustafagoksever Avatar asked Aug 09 '17 07:08

mustafagoksever


People also ask

How do you make a build parameterized?

Using build parameters, we can pass any data we want: git branch name, secret credentials, hostnames and ports, and so on. Any Jenkins job or pipeline can be parameterized. All we need to do is check the box on the General settings tab, “This project is parameterized”: Then we click the Add Parameter button.

What is build after other projects are built in Jenkins?

Build after other projects are builtIf your project depends on another project build then you should select Build after other projects are built option from the build triggers. After that, It starts watching the specified projects in the Projects to watch section.

What is a parameterised build?

Build parameters are name-value pairs, defined by a user or provided by TeamCity, which can be used in a build. They help flexibly share settings and pass them to build steps. This article explains how to configure build parameters.


1 Answers

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.

like image 59
ANIL Avatar answered Sep 28 '22 20:09

ANIL