Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass default values to a Jenkins build using the Parameterized Build Plugin?

Tags:

I'm using the Parameterized Build Plugin in Jenkins. I want to provide a link to the build page, but configure the default value for one of the fields that shows up in the form. This value is going to be different every time the job is run, but I want it to be configurable from some other page. Essentially I want to do something like click on a link that looks something like this:

https://jenkins/job/Sandbox/build?delay=0sec&Test=foo 

And see this on the build screen:

Jenkins build with default parameter Test=foo

So then I can fill out the rest of the values (or even modify the default value) and then click Build. Is this possible?

like image 903
wxactly Avatar asked Jun 03 '14 21:06

wxactly


People also ask

How do you pass parameters in Jenkins pipeline?

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 do you trigger a build with parameters in Jenkins?

In your Jenkins job configuration, tick the box named " This build is parameterized ", click the " Add Parameter " button and select the " String Parameter " drop down value. Latest Jenkins docs say that GET is depreciated for security reasons, so POST should be preferred.

What is the use of parameterized trigger plugin in Jenkins?

This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build. These new builds appear as "Subprojects" in the Jenkins UI when you are looking at a project that triggers them.

What Jenkins option we used to parameterize our Jenkins build?

To execute the Jenkins job from Jenkins web interface first go to respective project workspace and then click on “Build with Parameters” option from left panel. After that, you will be asked to choose/set parameter value (In my project I have set BROWSER parameter.)


1 Answers

Yes, it's absolutely doable - there is a plugin for that:

Build With Parameters Plugin.

Just install it and change the url to actually use the plugin:

https://jenkins/job/Sandbox/parambuild?Test=foo 

And that's should do it...

like image 118
Łukasz Rżanek Avatar answered Oct 14 '22 07:10

Łukasz Rżanek