How can I create parameterized Jenkins job? How can I create parameterized Jenkins job? jenkins jenkins

How can I create parameterized Jenkins job?


Example criteria:User needs to use different environments for executions.1. Select jenkins project2. Job -> Configure -> Select this project is parameterized check box.3. Select Add parameter drop down - > String parameter4. Define a string parameter (In my example I use environment variable as : BaseURL)

enter image description here

5.Now under build section initialize the mvn command user needs to execute.Here in this case I want to execute my jenkins build on a environment where I specify. So I should be able to execute my build in different environment each time with out changing the code.My mvn command: I pass my environment url as a parameter (Using $ sign). This is based on user requirement. clean test -Dcustomproperty="$BaseURL"

enter image description here

6. Apply and save your Jenkins project.7. Now your project is parameterized.  Then your project should have Build with parameters option.

enter image description here

8.Click Build with parameters link and enter your parameter (In this example my environment variable) and click build. Your jenkins job should run with the parameter.

enter image description here

NOTE: This build won't succeed unless the passing parameter is not utilized in the automation script. So script has to be modified to retrieve the passing variable.String BaseURL= System.getProperty("customproperty");


  1. Yes, you can pass a node label parameter with NodeLabel Parameter Plugin.

  2. Yes, you can define parameters, as described, in Parameterized Builds and then use it in your script as an environment variable:

The parameter is available as environment parameters. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env.FOO} ) can access these values.

  1. This is not exactly a return value, but you can pass any parameter (with its value) to the downstream job with Parameterized Trigger Plugin.