Remotely triggering jobs through the Jenkins API
Jenkins has a remote that allows you to enable, disable, run, and delete jobs; it also lets you change the configuration. The API is increasing with each Jenkins version. To get the most up-to-date details, you will need to review http://yourhost/job/Name_of_Job/api/
. Where yourhost
is the location of your Jenkins server, Name_of_Job
is the name of a job that exists on your server.
This recipe details how you can trigger builds remotely by using security tokens. This will allow you to run other jobs from within Maven.
Getting ready
This recipe expects Jenkins security to be turned on so that you can log in as a user. It also assumes you a modern version of wget
(http://www.gnu.org/software/wget/) installed.
How to do it...
- Create a Freestyle project with the project name
ch3.RunMe
. - Check
This Build
is parameterized, selectString Parameter
, and add the following details:Name
:myvariable
DefaultValue
:Default
Description
:This is my example variable...