How To Use Jenkins Parametered Build

Posted by Kakashi on 2017-02-13

When we build staging and production environment in Jenkins, we might find out a lot of parts are similar and we just need the variable to switch build. That’s the reason why we need this Jenkins parameterized build plugin. We can use it to define and switch some variables in your build script in order to increase flexibility.

Preparation

Install the plugin Parameterized Trigger plugin

Use

In your project, you need to select This project is parameterized
setting

As we can see, Jenkins provides several ways to configure your parameter.
for example, we could use Choice Parameter

build

Then we could see sidebar has addition option called Build with parameters.
Click it and you could see there is a choice for setting the stage.

building

This is a useful skill to manage your project, try to use this plugin to reduce duplicate configurations!

Ref: http://ithelp.ithome.com.tw/articles/10187358