Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger Jenkins builds remotely and to pass parameters

I am invoking a Jenkins job remotely using:

wget http://<ServerIP>:8080/job/Test-Jenkins/build?token=DOIT 

Here Test-Jenkins job is invoked and DOIT is the security token that I have used.

Now I need to pass some parameters to the build.xml file of this job i.e. Test-Jenkins.

I have not yet figured out how to pass the variables yet.

like image 541
Exploring Avatar asked Dec 03 '13 19:12

Exploring


People also ask

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.

How do I trigger a build in Jenkins remotely?

Create a remote Jenkins build trigger in three stepsCreate a Jenkins build job and enable the Trigger builds remotely checkbox. Provide an authentication token; This can be any text string of your choice. Invoke the Jenkins build URL to remotely trigger the build job.

Which command is used to trigger build remotely in Jenkins?

Configure a job to trigger from remote in Jenkins You can create a new FreeStyle job or you can use the previous one. Move to configuration -> Build Triggers sections and check the “Trigger builds remotely(e.g., from scripts)” option and paste the token name there.

How do you call a Jenkins build from outside Jenkins?

Install Generic Webhook Trigger plugin. Select generic webhook trigger in build trigger actions. Generate a random string and paste in token. Now your job can be triggered with a http request to the following url.


1 Answers

See Jenkins documentation: Parameterized Build

Below is the line you are interested in:

http://server/job/myjob/buildWithParameters?token=TOKEN&PARAMETER=Value 
like image 112
Peter Schuetze Avatar answered Sep 28 '22 00:09

Peter Schuetze