How to pass default values to a Jenkins build using the Parameterized Build Plugin?
Solution 1
Yes, it's absolutely doable - there is a plugin for that:
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...
Solution 2
You don't need any additional plugins for this. This comes natively with Jenkins
https://jenkins/job/Sandbox/buildWithParameters?delay=0sec&Test=foo
The above will trigger the build job immediately (or whatever the delay may be). This is suitable for automation.
The Build With Parameters Plugin is similar, but it will open a Jenkins confirmation page with pre-populated parameters (from the URL), and prompt the user to click the Build button. It is not suitable to automation.
Related videos on Youtube
wxactly
I don't really build things; I just build until things come into being.
Updated on November 01, 2020Comments
-
wxactly over 3 years
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:
So then I can fill out the rest of the values (or even modify the default value) and then click Build. Is this possible?
-
wxactly almost 10 yearsBuilds, Parameterized Builds, Builds With Parameters, Jenkins has it all. Thanks - that plugin does exactly what I need.
-
wxactly almost 10 yearsThanks for mentioning the fact that you can pass parameters without any additional plugins. It's not exactly what I needed for this use case, but this is the correct approach when you want to skip the build screen.
-
Kamil Dziedzic about 6 yearsIn installation I use it says "You must use POST method to trigger builds. (From scripts you may instead pass a per-project authentication token, or authenticate with your API token.) If you see this page, it may be because a plugin offered a GET link; file a bug report for that plugin." but there is "Proceed" button, and after clicking it it works.
-
limonik over 5 yearsHow can we avoid clicking Proceed button? Every time I have to click it manually and it is not anymore automated.
-
Slav over 5 years@limonik use
/buildWithParameters?token=mytoken&Test=foo
. The "token" needs to be set on per-project configuration under "Build Triggers > Trigger builds remotely" section -
Mac over 5 yearsHello All, I am looking for Build triggers with delay option and will send some parameters like above /build?delay=0sec?token=TOKEN_NAME&Test=foo, but it is not working.. please suggest any