DEV Community

Yash Chaudhari
Yash Chaudhari

Posted on

🤖 What is a Parameterized Job in Jenkins?

In Jenkins Parameterized Job is a type of job that allows us to select parameters while building the Jenkins Job.

There are various types of Parameters we can select.

For example - String, Choice, etc.

In this article, we are going to see how to make a Parameterized Jenkins Job.

1. Create a simple freestyle project.

2. Next, select the option - This project is parameterized, and click on Add Parameter.

3. Then, select the parameter type that you want to add.

4. Add the name of the parameter with a default value.

5. Next, in the Build steps section, select the Execute Shell option and add this command

echo $Param1
Enter fullscreen mode Exit fullscreen mode

6. Click on save and Build the Project. You will see Build with Parameters option. Click on that.

7. After clicking on the Build with Parameters option. Add the parameter value that you want to pass. In my case, I have passed "This is a Parameterized Jenkins Job". After that, click on Build.

8. Check the Console Output of the Job.

Use Cases -

  1. When we need to pass the values just before the job build, then we can pass the values.
    For example, if we are installing different versions of the software. So, we can pass the version of the software as a parameter.

  2. If there's a need that we have to pass the commands at run time. So, we can use this option.

Top comments (0)