Updated on 28 Dec 2018

What would a build and deployment process be like if you didn’t have options available? There is an annoying short-fall however, and you can see that in the screen shot below. It doesn’t show you the options that you chose on the main log UI screen.

Setting up

Setting up is pretty straight-forward.

  • Simply tick the check-box in the general section for This project is parameterized.
  • Add a new Parameter (in my case I selected choice)
  • Fill in the other fields.

Jenkins conditional build

No point in having parameters if we can’t use them. We can in fact have a conditional build-step with the parameters…

Notice here that $BuildType is the name of the parameter that we specified when we set up the parameters in an earlier step. The value Test was one of the values available. What we are doing is checking to see if we selected Test, and if so we would run


echo "YES, this is from deploy5.  this message only gets displayed if the Option selected was TEST! and is controlled from Jenkins."

Shell Script

The really exciting thing here is that $BuildType is also available to us in our shell scripts! We can see how different actions can be performed depending on the choice we made at the start of the build.


echo "Parameter for BuildType..."
echo $BuildType