Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing Build Parameters from one Jenkins project to another Jenkins project

Tags:

jenkins

How to pass build parameters from one project to another project?

Do we have any configuration in the Jenkins User interface which would pass build parameters of one build project after finishing it to another project?

I am able to trigger the other project but unable to pass build parameters. Do we have any scope of build parameters so that I can use it in all projects?

like image 252
Abhishek Suthar Avatar asked Jan 22 '15 00:01

Abhishek Suthar


People also ask

How do you transfer workspace and environment variables in a pipeline to the next job?

Under Build Environment check Set environment variables through a file. give the path of that file here. If the environment variable is created in the first job then again you can save all the environment variable in a file and browse it using the above method. Install this plugin and go to job configuration paeg.

How do you trigger a build with parameters in Jenkins?

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.

How does Jenkins pipeline pass choice parameters?

The following are some of the best practices you can follow while using parameters in a Jenkinsfile. Never pass passwords in the String or Multi-line parameter block. Instead, use the password parameter of access Jenkins credentials with credential id as the parameter. Try to use parameters only if required.


1 Answers

To do this, first install Parameterized Trigger Plugin

Then your first job configuration:

  1. select "Trigger/call builds on other projects" under build.
  2. give job name for "Projects to build"
  3. select matching option under "Add Parameters".

I use "Predefined parameters" and in the filed, I define like

 [email protected]
 build.user.id=abce
 mailPassWord=${mpWord}

Values set in those variable will be available for you in your second job selected under "Projects to build".

like image 64
Sreekanth Avatar answered Sep 28 '22 05:09

Sreekanth