Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameterized job always run with default parameter

Tags:

jenkins

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.

like image 537
General_Code Avatar asked Jan 19 '17 08:01

General_Code


People also ask

How do parameterized build job receive parameters?

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.

How is parameter passed to the job to be triggered?

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.

What is parameterized pipeline?

A parameterized pipeline allows us to set needed parameters dynamically at build time.

What is parameterized trigger?

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.


1 Answers

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.

like image 92
afxentios Avatar answered Nov 16 '22 03:11

afxentios