blob: 34aa4eac743f2d1201d4a962ac559c9552652ca1 [file] [log] [blame]
James E. Blair172c0762012-10-02 15:35:54 -07001.. _launchers:
James E. Blaircdd00072012-06-08 19:17:28 -07002:title: Launchers
3
4Launchers
5=========
6
7Zuul has a modular architecture for launching jobs. Currently only
8Jenkins is supported, but it should be fairly easy to add a module to
9support other systems. Zuul makes very few assumptions about the
10interface to a launcher -- if it can trigger jobs, cancel them, and
11receive success or failure reports, it should be able to be used with
12Zuul. Patches to this effect are welcome.
13
14Jenkins
15-------
16
17Zuul works with Jenkins using the Jenkins API and the notification
18module. It uses the Jenkins API to trigger jobs, passing in
19parameters indicating what should be tested. It recieves
20notifications on job completion via the notification API (so jobs must
21be conifigured to notify Zuul).
22
23Jenkins Configuration
24~~~~~~~~~~~~~~~~~~~~~
25
26Zuul will need access to a Jenkins user. Create a user in Jenkins,
27and then visit the configuration page for the user:
28
29 https://jenkins.example.com/user/USERNAME/configure
30
31And click **Show API Token** to retrieve the API token for that user.
32You will need this later when configuring Zuul. Make sure that this
33user has appropriate permission to build any jobs that you want Zuul
34to trigger.
35
36Make sure the notification plugin is installed. Visit the plugin
37manager on your jenkins:
38
39 https://jenkins.example.com/pluginManager/
40
41And install **Jenkins Notification plugin**. The homepage for the
42plugin is at:
43
44 https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin
45
46Jenkins Job Configuration
47~~~~~~~~~~~~~~~~~~~~~~~~~
48
49For each job that you want Zuul to trigger, you will need to add a
50notification endpoint for the job on that job's configuration page.
51Click **Add Endpoint** and enter the following values:
52
53**Protocol**
54 ``HTTP``
55**URL**
56 ``http://127.0.0.1:8001/jenkins_endpoint``
57
58If you are running Zuul on a different server than Jenkins, enter the
59appropriate URL. Note that Zuul itself has no access controls, so
60ensure that only Jenkins is permitted to access that URL.
61
62Zuul will pass some parameters to Jenkins for every job it launches.
63Check **This build is parameterized**, and add the following fields
64with the type **String Parameter**:
65
66**UUID**
67 Zuul provided key to link builds with Gerrit events
68**GERRIT_PROJECT**
69 Zuul provided project name
70**GERRIT_BRANCH**
71 Zuul provided branch name
72**GERRIT_CHANGES**
73 Zuul provided list of dependent changes to merge
74
75You may find it useful to use the ``GERRIT_*`` variables in your job.
76In particular, ``GERRIT_CHANGES`` indicates the change or changes that
77should be tested. If Zuul has decided that more than one change
78should be merged and tested together, they will all be listed in
79``GERRIT_CHANGES``. The format for the description of one change is::
80
81 project:branch:refspec
82
83And multiple changes are separated by a carat ("^"). E.g.::
84
85 testproject:master:refs/changes/20/420/1^testproject:master:refs/changes/21/421/1"
86
87The OpenStack project uses the following script to update the
88repository in a workspace and merge appropriate changes:
89
Antoine Mussofec5c7a2012-09-22 12:32:37 +020090 https://github.com/openstack/openstack-ci-puppet/blob/master/modules/jenkins/files/slave_scripts/gerrit-git-prep.sh
James E. Blaircdd00072012-06-08 19:17:28 -070091
92Gerrit events that do not include a change (e.g., ref-updated events
93which are emitted after a git ref is updated (i.e., a commit is merged
94to master)) require a slightly different set of parameters:
95
96**UUID**
97 Zuul provided key to link builds with Gerrit events
98**GERRIT_PROJECT**
99 Zuul provided project name
100**GERRIT_REFNAME**
101 Zuul provided ref name
102**GERRIT_OLDREV**
103 Zuul provided old reference for ref-updated
104**GERRIT_NEWREV**
105 Zuul provided new reference for ref-updated
106