23

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?

wxactly
  • 2,400
  • 1
  • 26
  • 42

3 Answers3

22

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...

wxactly
  • 2,400
  • 1
  • 26
  • 42
Łukasz Rżanek
  • 5,786
  • 27
  • 37
  • 1
    Builds, Parameterized Builds, Builds With Parameters, Jenkins has it all. Thanks - that plugin does exactly what I need. – wxactly Jun 04 '14 at 21:39
20

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.

Slav
  • 27,057
  • 11
  • 80
  • 104
  • 1
    Thanks 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. – wxactly Jun 04 '14 at 21:45
  • 2
    In 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. – Kamil Dziedzic Feb 08 '18 at 14:36
  • 1
    How can we avoid clicking Proceed button? Every time I have to click it manually and it is not anymore automated. – limonik Sep 03 '18 at 13:45
  • 2
    @limonik use `/buildWithParameters?token=mytoken&Test=foo`. The "token" needs to be set on per-project configuration under "Build Triggers > Trigger builds remotely" section – Slav Sep 04 '18 at 18:24
0

You can work with build triggers /build?token=TOKEN_NAME or /buildWithParameters?token=TOKEN_NAME&Test=foo&AnotherTest=(your value)

Madhur Bhaiya
  • 28,155
  • 10
  • 49
  • 57
Mac
  • 1
  • 1
  • Hello 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 – Mac Oct 31 '18 at 13:12