I am having troubles to force Jenkins job to always run with default parameter. Does anyone know the possible plugin to help with that case? Right now I am using extended parameter choice, but still there is no option to just run the job with default value without asking user for parameter.
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.
You can use Parameterized Trigger Plugin which will let you pass parameters from one task to another. You need also add this parameter you passed from upstream in downstream.
A parameterized pipeline allows us to set needed parameters dynamically at build time.
a set of predefined properties. properties from a properties file read from the workspace of the triggering build. the parameters of the current build. Subversion revision: makes sure the triggered projects are built with the same revision(s) of the triggering build.
Solution 1
Currently there is not a straight forward solution to run a parameterized job with default parameter using a plugin. However there is a workaround to accomplish that using the EnvInject Plugin.
As @General_Code noted:
Just add the build step, set the variable like: var1=value and then use it using ${var1}
Solution 2
As @RejeeshChandran noted: a more robust solution is the Parameterized Build Plugin which provides the functionality of defaults values for the parameters.
Note
Note that Parameter Defaults Options is a plugin under development which will solve exactly this request. When it is released, you will be able to set it up so your parameter will get a default value when you run it manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With