blob: 56cc6a87ab6eb9f2c6675314d035b6c150db3234 [file] [log] [blame]
James E. Blaircdd00072012-06-08 19:17:28 -07001:title: Zuul
2
3Zuul
4====
5
6Configuration
7-------------
8
9Zuul has three configuration files:
10
11**zuul.conf**
James E. Blair1f4c2bb2013-04-26 08:40:46 -070012 Connection information for Gerrit and Gearman, locations of the
Thanh Ha266cbb82016-01-24 20:57:59 -050013 other config files. (required)
James E. Blaircdd00072012-06-08 19:17:28 -070014**layout.yaml**
Thanh Ha266cbb82016-01-24 20:57:59 -050015 Project and pipeline configuration -- what Zuul does. (required)
James E. Blaircdd00072012-06-08 19:17:28 -070016**logging.conf**
Thanh Ha266cbb82016-01-24 20:57:59 -050017 Python logging config. (optional)
James E. Blaircdd00072012-06-08 19:17:28 -070018
19Examples of each of the three files can be found in the etc/ directory
20of the source distribution.
21
James E. Blair6aea36d2012-12-17 13:03:24 -080022.. _zuulconf:
23
James E. Blaircdd00072012-06-08 19:17:28 -070024zuul.conf
25~~~~~~~~~
26
27Zuul will look for ``/etc/zuul/zuul.conf`` or ``~/zuul.conf`` to
28bootstrap its configuration. Alternately, you may specify ``-c
29/path/to/zuul.conf`` on the command line.
30
James E. Blair1f4c2bb2013-04-26 08:40:46 -070031Gerrit and Gearman connection information are each described in a
32section of zuul.conf. The location of the other two configuration
33files (as well as the location of the PID file when running Zuul as a
34server) are specified in a third section.
James E. Blaircdd00072012-06-08 19:17:28 -070035
Clark Boylan9b670902012-09-28 13:47:56 -070036The three sections of this config and their options are documented below.
37You can also find an example zuul.conf file in the git
38`repository
Andreas Jaegerbcfbf932014-09-29 20:21:44 +020039<https://git.openstack.org/cgit/openstack-infra/zuul/tree/etc/zuul.conf-sample>`_
Clark Boylan9b670902012-09-28 13:47:56 -070040
James E. Blair1f4c2bb2013-04-26 08:40:46 -070041gearman
Clark Boylan9b670902012-09-28 13:47:56 -070042"""""""
43
Thanh Ha266cbb82016-01-24 20:57:59 -050044Client connection information for gearman. If using Zuul's builtin gearmand
45server just set **server** to 127.0.0.1.
46
Clark Boylan9b670902012-09-28 13:47:56 -070047**server**
James E. Blair1f4c2bb2013-04-26 08:40:46 -070048 Hostname or IP address of the Gearman server.
Thanh Ha266cbb82016-01-24 20:57:59 -050049 ``server=gearman.example.com`` (required)
Clark Boylan9b670902012-09-28 13:47:56 -070050
James E. Blair1f4c2bb2013-04-26 08:40:46 -070051**port**
Łukasz Jernaś048acb42014-03-02 18:49:41 +010052 Port on which the Gearman server is listening.
Thanh Ha266cbb82016-01-24 20:57:59 -050053 ``port=4730`` (optional)
Clark Boylan9b670902012-09-28 13:47:56 -070054
James E. Blair77cc7b82013-07-15 13:22:37 -070055gearman_server
56""""""""""""""
57
Thanh Ha266cbb82016-01-24 20:57:59 -050058The builtin gearman server. Zuul can fork a gearman process from itself rather
59than connecting to an external one.
60
James E. Blair77cc7b82013-07-15 13:22:37 -070061**start**
62 Whether to start the internal Gearman server (default: False).
63 ``start=true``
64
James E. Blair0ac452e2015-07-22 09:05:16 -070065**listen_address**
66 IP address or domain name on which to listen (default: all addresses).
67 ``listen_address=127.0.0.1``
68
James E. Blair77cc7b82013-07-15 13:22:37 -070069**log_config**
70 Path to log config file for internal Gearman server.
71 ``log_config=/etc/zuul/gearman-logging.yaml``
72
Paul Belanger88ef0ea2015-12-23 11:57:02 -050073webapp
74""""""
75
76**listen_address**
77 IP address or domain name on which to listen (default: 0.0.0.0).
78 ``listen_address=127.0.0.1``
79
80**port**
81 Port on which the webapp is listening (default: 8001).
82 ``port=8008``
83
Clark Boylan9b670902012-09-28 13:47:56 -070084zuul
85""""
86
Thanh Ha266cbb82016-01-24 20:57:59 -050087Zuul's main configuration section. At minimum zuul must be able to find
88layout.yaml to be useful.
89
90.. note:: Must be provided when running zuul-server
91
Antoine Musso9adc6d42014-11-14 15:37:48 +010092.. _layout_config:
93
Clark Boylan9b670902012-09-28 13:47:56 -070094**layout_config**
James E. Blair4076e2b2014-01-28 12:42:20 -080095 Path to layout config file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -070096 ``layout_config=/etc/zuul/layout.yaml``
97
98**log_config**
James E. Blaira4430132014-02-17 08:32:07 -080099 Path to log config file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -0700100 ``log_config=/etc/zuul/logging.yaml``
101
102**pidfile**
James E. Blaira4430132014-02-17 08:32:07 -0800103 Path to PID lock file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -0700104 ``pidfile=/var/run/zuul/zuul.pid``
105
106**state_dir**
James E. Blair4076e2b2014-01-28 12:42:20 -0800107 Path to directory that Zuul should save state to. Used by all Zuul
108 commands.
Clark Boylan9b670902012-09-28 13:47:56 -0700109 ``state_dir=/var/lib/zuul``
110
James E. Blair4076e2b2014-01-28 12:42:20 -0800111**report_times**
112 Boolean value (``true`` or ``false``) that determines if Zuul should
113 include elapsed times for each job in the textual report. Used by
114 zuul-server only.
115 ``report_times=true``
116
117**status_url**
118 URL that will be posted in Zuul comments made to Gerrit changes when
119 starting jobs for a change. Used by zuul-server only.
120 ``status_url=https://zuul.example.com/status``
121
Clark Boylane0b4bdb2014-06-03 17:01:25 -0700122**status_expiry**
123 Zuul will cache the status.json file for this many seconds. This is an
124 optional value and ``1`` is used by default.
125 ``status_expiry=1``
126
James E. Blair4076e2b2014-01-28 12:42:20 -0800127**job_name_in_report**
128 Boolean value (``true`` or ``false``) that indicates whether the
129 job name should be included in the report (normally only the URL
130 is included). Defaults to ``false``. Used by zuul-server only.
131 ``job_name_in_report=true``
132
133merger
134""""""
135
Thanh Ha266cbb82016-01-24 20:57:59 -0500136The zuul-merger process configuration. Detailed documentation on this process
137can be found on the :doc:`merger` page.
138
139.. note:: Must be provided when running zuul-merger. Both services may share the
140 same configuration (and even host) or otherwise have an individual
141 zuul.conf.
142
Clark Boylan9b670902012-09-28 13:47:56 -0700143**git_dir**
144 Directory that Zuul should clone local git repositories to.
145 ``git_dir=/var/lib/zuul/git``
146
Paul Belangerb67aba12013-05-13 19:22:14 -0400147**git_user_email**
148 Optional: Value to pass to `git config user.email`.
149 ``git_user_email=zuul@example.com``
150
151**git_user_name**
152 Optional: Value to pass to `git config user.name`.
153 ``git_user_name=zuul``
154
Arx Cruzb1b010d2013-10-28 19:49:59 -0200155**zuul_url**
James E. Blair4076e2b2014-01-28 12:42:20 -0800156 URL of this merger's git repos, accessible to test workers. Usually
157 "http://zuul.example.com/p" or "http://zuul-merger01.example.com/p"
158 depending on whether the merger is co-located with the Zuul server.
Arx Cruzb1b010d2013-10-28 19:49:59 -0200159
James E. Blaira4430132014-02-17 08:32:07 -0800160**log_config**
161 Path to log config file for the merger process.
162 ``log_config=/etc/zuul/logging.yaml``
163
164**pidfile**
165 Path to PID lock file for the merger process.
166 ``pidfile=/var/run/zuul-merger/merger.pid``
167
Joshua Heskethfe485c62015-08-11 23:42:34 +1000168.. _connection:
169
170connection ArbitraryName
171""""""""""""""""""""""""
172
173A connection can be listed with any arbitrary name. The required
174parameters are specified in the :ref:`connections` documentation
175depending on what driver you are using.
176
177.. _layoutyaml:
178
James E. Blaircdd00072012-06-08 19:17:28 -0700179layout.yaml
180~~~~~~~~~~~
181
Clark Boylan00635dc2012-09-19 14:03:08 -0700182This is the main configuration file for Zuul, where all of the pipelines
James E. Blaircdd00072012-06-08 19:17:28 -0700183and projects are defined, what tests should be run, and what actions
Clark Boylan00635dc2012-09-19 14:03:08 -0700184Zuul should perform. There are three sections: pipelines, jobs, and
James E. Blaircdd00072012-06-08 19:17:28 -0700185projects.
186
Clark Boylan00635dc2012-09-19 14:03:08 -0700187Pipelines
188"""""""""
James E. Blaircdd00072012-06-08 19:17:28 -0700189
Clark Boylan00635dc2012-09-19 14:03:08 -0700190Zuul can have any number of independent pipelines. Whenever a matching
191Gerrit event is found for a pipeline, that event is added to the
192pipeline, and the jobs specified for that pipeline are run. When all
193jobs specified for the pipeline that were triggered by an event are
194completed, Zuul reports back to Gerrit the results.
James E. Blaircdd00072012-06-08 19:17:28 -0700195
Clark Boylan00635dc2012-09-19 14:03:08 -0700196There are no pre-defined pipelines in Zuul, rather you can define
197whatever pipelines you need in the layout file. This is a very flexible
198system that can accommodate many kinds of workflows.
James E. Blaircdd00072012-06-08 19:17:28 -0700199
Clark Boylan00635dc2012-09-19 14:03:08 -0700200Here is a quick example of a pipeline definition followed by an
James E. Blaircdd00072012-06-08 19:17:28 -0700201explanation of each of the parameters::
202
203 - name: check
Clark Boylan00635dc2012-09-19 14:03:08 -0700204 manager: IndependentPipelineManager
Joshua Heskethfe485c62015-08-11 23:42:34 +1000205 source: my_gerrit
James E. Blaircdd00072012-06-08 19:17:28 -0700206 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000207 my_gerrit:
James E. Blair6c358e72013-07-29 17:06:47 -0700208 - event: patchset-created
James E. Blaircdd00072012-06-08 19:17:28 -0700209 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000210 my_gerrit:
211 verified: 1
James E. Blaircdd00072012-06-08 19:17:28 -0700212 failure:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000213 my_gerrit
214 verified: -1
James E. Blaircdd00072012-06-08 19:17:28 -0700215
216**name**
217 This is used later in the project definition to indicate what jobs
Clark Boylan00635dc2012-09-19 14:03:08 -0700218 should be run for events in the pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700219
James E. Blair8dbd56a2012-12-22 10:55:10 -0800220**description**
221 This is an optional field that may be used to provide a textual
222 description of the pipeline.
223
James E. Blairc0dedf82014-08-06 09:37:52 -0700224**source**
Joshua Heskethfe485c62015-08-11 23:42:34 +1000225 A required field that specifies a connection that provides access to
226 the change objects that this pipeline operates on. The name of the
227 connection as per the zuul.conf should be specified. The driver used
228 for the connection named will be the source. Currently only ``gerrit``
229 drivers are supported.
James E. Blairc0dedf82014-08-06 09:37:52 -0700230
James E. Blair56370192013-01-14 15:47:28 -0800231**success-message**
232 An optional field that supplies the introductory text in message
233 reported back to Gerrit when all the voting builds are successful.
234 Defaults to "Build successful."
235
236**failure-message**
237 An optional field that supplies the introductory text in message
238 reported back to Gerrit when at least one voting build fails.
239 Defaults to "Build failed."
240
Joshua Heskethb7179772014-01-30 23:30:46 +1100241**merge-failure-message**
242 An optional field that supplies the introductory text in message
243 reported back to Gerrit when a change fails to merge with the
244 current state of the repository.
245 Defaults to "Merge failed."
246
Joshua Hesketh3979e3e2014-03-04 11:21:10 +1100247**footer-message**
248 An optional field to supply additional information after test results.
249 Useful for adding information about the CI system such as debugging
250 and contact details.
251
James E. Blaircdd00072012-06-08 19:17:28 -0700252**manager**
Clark Boylan00635dc2012-09-19 14:03:08 -0700253 There are currently two schemes for managing pipelines:
James E. Blaircdd00072012-06-08 19:17:28 -0700254
Clark Boylan00635dc2012-09-19 14:03:08 -0700255 *IndependentPipelineManager*
256 Every event in this pipeline should be treated as independent of
257 other events in the pipeline. This is appropriate when the order of
258 events in the pipeline doesn't matter because the results of the
259 actions this pipeline performs can not affect other events in the
260 pipeline. For example, when a change is first uploaded for review,
James E. Blaircdd00072012-06-08 19:17:28 -0700261 you may want to run tests on that change to provide early feedback
262 to reviewers. At the end of the tests, the change is not going to
263 be merged, so it is safe to run these tests in parallel without
Clark Boylan00635dc2012-09-19 14:03:08 -0700264 regard to any other changes in the pipeline. They are independent.
James E. Blaircdd00072012-06-08 19:17:28 -0700265
Clark Boylan00635dc2012-09-19 14:03:08 -0700266 Another type of pipeline that is independent is a post-merge
267 pipeline. In that case, the changes have already merged, so the
268 results can not affect any other events in the pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700269
Clark Boylan00635dc2012-09-19 14:03:08 -0700270 *DependentPipelineManager*
271 The dependent pipeline manager is designed for gating. It ensures
James E. Blaircdd00072012-06-08 19:17:28 -0700272 that every change is tested exactly as it is going to be merged
273 into the repository. An ideal gating system would test one change
274 at a time, applied to the tip of the repository, and only if that
275 change passed tests would it be merged. Then the next change in
276 line would be tested the same way. In order to achieve parallel
Clark Boylan00635dc2012-09-19 14:03:08 -0700277 testing of changes, the dependent pipeline manager performs
James E. Blaircdd00072012-06-08 19:17:28 -0700278 speculative execution on changes. It orders changes based on
Clark Boylan00635dc2012-09-19 14:03:08 -0700279 their entry into the pipeline. It begins testing all changes in
280 parallel, assuming that each change ahead in the pipeline will pass
James E. Blaircdd00072012-06-08 19:17:28 -0700281 its tests. If they all succeed, all the changes can be tested and
Clark Boylan00635dc2012-09-19 14:03:08 -0700282 merged in parallel. If a change near the front of the pipeline
283 fails its tests, each change behind it ignores whatever tests have
284 been completed and are tested again without the change in front.
285 This way gate tests may run in parallel but still be tested
286 correctly, exactly as they will appear in the repository when
287 merged.
James E. Blaircdd00072012-06-08 19:17:28 -0700288
Clark Boylan00635dc2012-09-19 14:03:08 -0700289 One important characteristic of the DependentPipelineManager is that
James E. Blaircdd00072012-06-08 19:17:28 -0700290 it analyzes the jobs that are triggered by different projects, and
291 if those projects have jobs in common, it treats those projects as
292 related, and they share a single virtual queue of changes. Thus,
293 if there is a job that performs integration testing on two
294 projects, those two projects will automatically share a virtual
295 change queue. If a third project does not invoke that job, it
Clark Boylan00635dc2012-09-19 14:03:08 -0700296 will be part of a separate virtual change queue, and changes to
297 it will not depend on changes to the first two jobs.
James E. Blaircdd00072012-06-08 19:17:28 -0700298
299 For more detail on the theory and operation of Zuul's
Clark Boylan00635dc2012-09-19 14:03:08 -0700300 DependentPipelineManager, see: :doc:`gating`.
James E. Blaircdd00072012-06-08 19:17:28 -0700301
302**trigger**
James E. Blairc494d542014-08-06 09:23:52 -0700303 At least one trigger source must be supplied for each pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700304 Triggers are not exclusive -- matching events may be placed in
James E. Blair6c358e72013-07-29 17:06:47 -0700305 multiple pipelines, and they will behave independently in each of
Joshua Heskethfe485c62015-08-11 23:42:34 +1000306 the pipelines they match.
James E. Blaircdd00072012-06-08 19:17:28 -0700307
Joshua Heskethfe485c62015-08-11 23:42:34 +1000308 Triggers are loaded from their connection name. The driver type of
309 the connection will dictate which options are available.
310 See :doc:`triggers`.
James E. Blairc494d542014-08-06 09:23:52 -0700311
James E. Blair11041d22014-05-02 14:49:53 -0700312**require**
313 If this section is present, it established pre-requisites for any
314 kind of item entering the Pipeline. Regardless of how the item is
315 to be enqueued (via any trigger or automatic dependency resolution),
316 the conditions specified here must be met or the item will not be
317 enqueued.
318
Antoine Musso27ab0d52014-10-22 14:20:17 +0200319.. _pipeline-require-approval:
320
James E. Blair5bf78a32015-07-30 18:08:24 +0000321 **approval**
James E. Blair11041d22014-05-02 14:49:53 -0700322 This requires that a certain kind of approval be present for the
323 current patchset of the change (the approval could be added by the
324 event in question). It takes several sub-parameters, all of which
325 are optional and are combined together so that there must be an
326 approval matching all specified requirements.
327
328 *username*
James E. Blairb01ec542016-06-16 09:46:49 -0700329 If present, an approval from this username is required. It is
330 treated as a regular expression.
James E. Blair11041d22014-05-02 14:49:53 -0700331
James E. Blair1fbfceb2014-06-23 14:42:53 -0700332 *email*
James E. Blair11041d22014-05-02 14:49:53 -0700333 If present, an approval with this email address is required. It
James E. Blairb01ec542016-06-16 09:46:49 -0700334 is treated as a regular expression.
James E. Blair11041d22014-05-02 14:49:53 -0700335
James E. Blair1fbfceb2014-06-23 14:42:53 -0700336 *email-filter* (deprecated)
337 A deprecated alternate spelling of *email*. Only one of *email* or
338 *email_filter* should be used.
339
James E. Blair11041d22014-05-02 14:49:53 -0700340 *older-than*
341 If present, the approval must be older than this amount of time
342 to match. Provide a time interval as a number with a suffix of
343 "w" (weeks), "d" (days), "h" (hours), "m" (minutes), "s"
344 (seconds). Example ``48h`` or ``2d``.
345
346 *newer-than*
347 If present, the approval must be newer than this amount of time
348 to match. Same format as "older-than".
349
350 Any other field is interpreted as a review category and value
351 pair. For example ``verified: 1`` would require that the approval
James E. Blair9c17dbf2014-06-23 14:21:58 -0700352 be for a +1 vote in the "Verified" column. The value may either
353 be a single value or a list: ``verified: [1, 2]`` would match
354 either a +1 or +2 vote.
James E. Blair11041d22014-05-02 14:49:53 -0700355
356 **open**
357 A boolean value (``true`` or ``false``) that indicates whether the change
358 must be open or closed in order to be enqueued.
359
Clark Boylana9702ad2014-05-08 17:17:24 -0700360 **current-patchset**
361 A boolean value (``true`` or ``false``) that indicates whether the change
362 must be the current patchset in order to be enqueued.
363
James E. Blair11041d22014-05-02 14:49:53 -0700364 **status**
365 A string value that corresponds with the status of the change
366 reported by the trigger. For example, when using the Gerrit
367 trigger, status values such as ``NEW`` or ``MERGED`` may be useful.
James E. Blair63bb0ef2013-07-29 17:14:51 -0700368
Joshua Hesketh66c8e522014-06-26 15:30:08 +1000369**reject**
370 If this section is present, it establishes pre-requisites that can
371 block an item from being enqueued. It can be considered a negative
372 version of **require**.
373
374 **approval**
375 This takes a list of approvals. If an approval matches the provided
376 criteria the change can not be entered into the pipeline. It follows
377 the same syntax as the :ref:`"require approval" pipeline above
378 <pipeline-require-approval>`.
379
380 Example to reject a change with any negative vote::
381
382 reject:
383 approval:
384 - code-review: [-1, -2]
385
James E. Blair2fa50962013-01-30 21:50:41 -0800386**dequeue-on-new-patchset**
387 Normally, if a new patchset is uploaded to a change that is in a
388 pipeline, the existing entry in the pipeline will be removed (with
389 jobs canceled and any dependent changes that can no longer merge as
390 well. To suppress this behavior (and allow jobs to continue
391 running), set this to ``false``. Default: ``true``.
392
James E. Blair17dd6772015-02-09 14:45:18 -0800393**ignore-dependencies**
394 In any kind of pipeline (dependent or independent), Zuul will
395 attempt to enqueue all dependencies ahead of the current change so
396 that they are tested together (independent pipelines report the
397 results of each change regardless of the results of changes ahead).
398 To ignore dependencies completely in an independent pipeline, set
399 this to ``true``. This option is ignored by dependent pipelines.
400 The default is: ``false``.
401
James E. Blaircdd00072012-06-08 19:17:28 -0700402**success**
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000403 Describes where Zuul should report to if all the jobs complete
404 successfully.
James E. Blaircdd00072012-06-08 19:17:28 -0700405 This section is optional; if it is omitted, Zuul will run jobs and
406 do nothing on success; it will not even report a message to Gerrit.
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000407 If the section is present, the listed reporter plugins will be
408 asked to report on the jobs.
Joshua Heskethfe485c62015-08-11 23:42:34 +1000409 The reporters are listed by their connection name. The options
410 available depend on the driver for the supplied connection.
411 See :doc:`reporters` for more details.
James E. Blaircdd00072012-06-08 19:17:28 -0700412
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400413**failure**
James E. Blaircdd00072012-06-08 19:17:28 -0700414 Uses the same syntax as **success**, but describes what Zuul should
415 do if at least one job fails.
James E. Blairdc253862012-06-13 17:12:42 -0700416
Joshua Heskethb7179772014-01-30 23:30:46 +1100417**merge-failure**
418 Uses the same syntax as **success**, but describes what Zuul should
419 do if it is unable to merge in the patchset. If no merge-failure
420 reporters are listed then the ``failure`` reporters will be used to
421 notify of unsuccessful merges.
422
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400423**start**
James E. Blairdc253862012-06-13 17:12:42 -0700424 Uses the same syntax as **success**, but describes what Zuul should
Clark Boylan00635dc2012-09-19 14:03:08 -0700425 do when a change is added to the pipeline manager. This can be used,
James E. Blairdc253862012-06-13 17:12:42 -0700426 for example, to reset the value of the Verified review category.
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400427
Joshua Hesketh89e829d2015-02-10 16:29:45 +1100428**disabled**
429 Uses the same syntax as **success**, but describes what Zuul should
430 do when a pipeline is disabled.
431 See ``disable-after-consecutive-failures``.
432
433**disable-after-consecutive-failures**
434 If set, a pipeline can enter a ''disabled'' state if too many changes
435 in a row fail. When this value is exceeded the pipeline will stop
436 reporting to any of the ``success``, ``failure`` or ``merge-failure``
437 reporters and instead only report to the ``disabled`` reporters.
438 (No ``start`` reports are made when a pipeline is disabled).
439
James E. Blair64ed6f22013-07-10 14:07:23 -0700440**precedence**
441 Indicates how the build scheduler should prioritize jobs for
442 different pipelines. Each pipeline may have one precedence, jobs
443 for pipelines with a higher precedence will be run before ones with
444 lower. The value should be one of ``high``, ``normal``, or ``low``.
445 Default: ``normal``.
446
Clark Boylanc2d19e42014-01-23 14:08:58 -0800447**window**
448 DependentPipelineManagers only. Zuul can rate limit
449 DependentPipelineManagers in a manner similar to TCP flow control.
450 Jobs are only started for changes in the queue if they sit in the
451 actionable window for the pipeline. The initial length of this window
452 is configurable with this value. The value given should be a positive
453 integer value. A value of ``0`` disables rate limiting on the
454 DependentPipelineManager.
455 Default: ``20``.
456
457**window-floor**
458 DependentPipelineManagers only. This is the minimum value for the
459 window described above. Should be a positive non zero integer value.
460 Default: ``3``.
461
462**window-increase-type**
463 DependentPipelineManagers only. This value describes how the window
464 should grow when changes are successfully merged by zuul. A value of
465 ``linear`` indicates that ``window-increase-factor`` should be added
466 to the previous window value. A value of ``exponential`` indicates
467 that ``window-increase-factor`` should be multiplied against the
468 previous window value and the result will become the window size.
469 Default: ``linear``.
470
471**window-increase-factor**
Clint Adams041ae512015-06-16 20:02:29 -0400472 DependentPipelineManagers only. The value to be added or multiplied
Clark Boylanc2d19e42014-01-23 14:08:58 -0800473 against the previous window value to determine the new window after
474 successful change merges.
475 Default: ``1``.
476
477**window-decrease-type**
478 DependentPipelineManagers only. This value describes how the window
479 should shrink when changes are not able to be merged by Zuul. A value
480 of ``linear`` indicates that ``window-decrease-factor`` should be
481 subtracted from the previous window value. A value of ``exponential``
482 indicates that ``window-decrease-factor`` should be divided against
483 the previous window value and the result will become the window size.
484 Default: ``exponential``.
485
486**window-decrease-factor**
487 DependentPipelineManagers only. The value to be subtracted or divided
488 against the previous window value to determine the new window after
489 unsuccessful change merges.
490 Default: ``2``.
491
Clark Boylan00635dc2012-09-19 14:03:08 -0700492Some example pipeline configurations are included in the sample layout
493file. The first is called a *check* pipeline::
James E. Blaircdd00072012-06-08 19:17:28 -0700494
495 - name: check
Clark Boylan00635dc2012-09-19 14:03:08 -0700496 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700497 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000498 my_gerrit:
499 - event: patchset-created
James E. Blaircdd00072012-06-08 19:17:28 -0700500 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000501 my_gerrit:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000502 verified: 1
James E. Blaircdd00072012-06-08 19:17:28 -0700503 failure:
Thomas Bechtolda8c0dbd2015-12-10 07:16:54 +0100504 my_gerrit:
505 verified: -1
James E. Blaircdd00072012-06-08 19:17:28 -0700506
507This will trigger jobs each time a new patchset (or change) is
508uploaded to Gerrit, and report +/-1 values to Gerrit in the
509``verified`` review category. ::
510
511 - name: gate
Clark Boylan00635dc2012-09-19 14:03:08 -0700512 manager: DependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700513 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000514 my_gerrit:
515 - event: comment-added
516 approval:
517 - approved: 1
James E. Blaircdd00072012-06-08 19:17:28 -0700518 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000519 my_gerrit:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000520 verified: 2
521 submit: true
James E. Blaircdd00072012-06-08 19:17:28 -0700522 failure:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000523 my_gerrit:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000524 verified: -2
James E. Blaircdd00072012-06-08 19:17:28 -0700525
526This will trigger jobs whenever a reviewer leaves a vote of ``1`` in the
527``approved`` review category in Gerrit (a non-standard category).
528Changes will be tested in such a way as to guarantee that they will be
529merged exactly as tested, though that will happen in parallel by
530creating a virtual queue of dependent changes and performing
531speculative execution of jobs. ::
532
533 - name: post
Clark Boylan00635dc2012-09-19 14:03:08 -0700534 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700535 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000536 my_gerrit:
537 - event: ref-updated
538 ref: ^(?!refs/).*$
James E. Blaircdd00072012-06-08 19:17:28 -0700539
540This will trigger jobs whenever a change is merged to a named branch
541(e.g., ``master``). No output will be reported to Gerrit. This is
542useful for side effects such as creating per-commit tarballs. ::
543
544 - name: silent
Clark Boylan00635dc2012-09-19 14:03:08 -0700545 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700546 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000547 my_gerrit:
548 - event: patchset-created
James E. Blaircdd00072012-06-08 19:17:28 -0700549
550This also triggers jobs when changes are uploaded to Gerrit, but no
551results are reported to Gerrit. This is useful for jobs that are in
Antoine Mussoce333842012-10-16 14:42:35 +0200552development and not yet ready to be presented to developers. ::
553
554 pipelines:
555 - name: post-merge
556 manager: IndependentPipelineManager
557 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000558 my_gerrit:
559 - event: change-merged
Antoine Mussoce333842012-10-16 14:42:35 +0200560 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000561 my_gerrit:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000562 force-message: True
Antoine Mussoce333842012-10-16 14:42:35 +0200563 failure:
Joshua Heskethfe485c62015-08-11 23:42:34 +1000564 my_gerrit:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000565 force-message: True
Antoine Mussoce333842012-10-16 14:42:35 +0200566
567The ``change-merged`` events happen when a change has been merged in the git
568repository. The change is thus closed and Gerrit will not accept modifications
569to the review scoring such as ``code-review`` or ``verified``. By using the
570``force-message: True`` parameter, Zuul will pass ``--force-message`` to the
571``gerrit review`` command, thus making sure the message is actually
572sent back to Gerrit regardless of approval scores.
573That kind of pipeline is nice to run regression or performance tests.
574
575.. note::
576 The ``change-merged`` event does not include the commit sha1 which can be
577 hazardous, it would let you report back to Gerrit though. If you were to
Michael Prokop526926a2013-10-24 16:16:57 +0200578 build a tarball for a specific commit, you should consider instead using
Łukasz Jernaś048acb42014-03-02 18:49:41 +0100579 the ``ref-updated`` event which does include the commit sha1 (but lacks the
Antoine Mussoce333842012-10-16 14:42:35 +0200580 Gerrit change number).
James E. Blaircdd00072012-06-08 19:17:28 -0700581
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100582
583.. _jobs:
584
James E. Blaircdd00072012-06-08 19:17:28 -0700585Jobs
586""""
587
588The jobs section is optional, and can be used to set attributes of
589jobs that are independent of their association with a project. For
590example, if a job should return a customized message on failure, that
591may be specified here. Otherwise, Zuul does not need to be told about
592each job as it builds a list from the project specification.
593
594**name**
595 The name of the job. This field is treated as a regular expression
596 and will be applied to each job that matches.
597
James E. Blairc8a1e052014-02-25 09:29:26 -0800598**queue-name (optional)**
599 Zuul will automatically combine projects that share a job into
600 shared change queues for dependent pipeline managers. In order to
601 report statistics about these queues, it is convenient for them to
602 have names. Zuul can automatically name change queues, however
603 these can grow quite long and are prone to changing as projects in
604 the queue change. If you assign a queue-name to a job, Zuul will
605 use that as the name for the shared change queue that contains that
606 job instead of the automatically generated one. It is an error for
607 a shared change queue to have more than one job with a queue-name if
608 they are not the same.
609
James E. Blaire5a847f2012-07-10 15:29:14 -0700610**failure-message (optional)**
611 The message that should be reported to Gerrit if the job fails.
James E. Blaircdd00072012-06-08 19:17:28 -0700612
James E. Blaire5a847f2012-07-10 15:29:14 -0700613**success-message (optional)**
614 The message that should be reported to Gerrit if the job fails.
James E. Blaircdd00072012-06-08 19:17:28 -0700615
James E. Blair6aea36d2012-12-17 13:03:24 -0800616**failure-pattern (optional)**
617 The URL that should be reported to Gerrit if the job fails.
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700618 Defaults to the build URL or the url_pattern configured in
James E. Blair6aea36d2012-12-17 13:03:24 -0800619 zuul.conf. May be supplied as a string pattern with substitutions
620 as described in url_pattern in :ref:`zuulconf`.
621
622**success-pattern (optional)**
623 The URL that should be reported to Gerrit if the job succeeds.
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700624 Defaults to the build URL or the url_pattern configured in
James E. Blair6aea36d2012-12-17 13:03:24 -0800625 zuul.conf. May be supplied as a string pattern with substitutions
626 as described in url_pattern in :ref:`zuulconf`.
627
James E. Blair222d4982012-07-16 09:31:19 -0700628**hold-following-changes (optional)**
629 This is a boolean that indicates that changes that follow this
Clark Boylan00635dc2012-09-19 14:03:08 -0700630 change in a dependent change pipeline should wait until this job
Paul Belanger174a8272017-03-14 13:20:10 -0400631 succeeds before executing. If this is applied to a very short job
James E. Blair222d4982012-07-16 09:31:19 -0700632 that can predict whether longer jobs will fail early, this can be
Paul Belanger174a8272017-03-14 13:20:10 -0400633 used to reduce the number of jobs that Zuul will execute and
James E. Blair222d4982012-07-16 09:31:19 -0700634 ultimately have to cancel. In that case, a small amount of
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400635 parallelization of jobs is traded for more efficient use of testing
James E. Blair222d4982012-07-16 09:31:19 -0700636 resources. On the other hand, to apply this to a long running job
637 would largely defeat the parallelization of dependent change testing
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400638 that is the main feature of Zuul. Default: ``false``.
James E. Blair222d4982012-07-16 09:31:19 -0700639
Tobias Henkel9a0e1942017-03-20 16:16:02 +0100640**semaphore (optional)**
641 This is a string that names a semaphore that should be observed by this
642 job. The semaphore defines how many jobs which reference that semaphore
643 can be enqueued at a time. This applies across all pipelines in the same
644 tenant. The max value of the semaphore can be specified in the config
645 repositories and defaults to 1.
James E. Blairaf17a972016-02-03 15:07:18 -0800646
James E. Blaire5a847f2012-07-10 15:29:14 -0700647**branch (optional)**
James E. Blaircdd00072012-06-08 19:17:28 -0700648 This job should only be run on matching branches. This field is
649 treated as a regular expression and multiple branches may be
650 listed.
651
James E. Blair70c71582013-03-06 08:50:50 -0800652**files (optional)**
653 This job should only be run if at least one of the files involved in
654 the change (added, deleted, or modified) matches at least one of the
655 file patterns listed here. This field is treated as a regular
656 expression and multiple expressions may be listed.
657
Maru Newby3fe5f852015-01-13 04:22:14 +0000658**skip-if (optional)**
659
660 This job should not be run if all the patterns specified by the
661 optional fields listed below match on their targets. When multiple
662 sets of parameters are provided, this job will be skipped if any set
663 matches. For example: ::
664
665 jobs:
666 - name: check-tempest-dsvm-neutron
667 skip-if:
668 - project: ^openstack/neutron$
669 branch: ^stable/juno$
670 all-files-match-any:
671 - ^neutron/tests/.*$
672 - ^tools/.*$
673 - all-files-match-any:
674 - ^doc/.*$
675 - ^.*\.rst$
676
677 With this configuration, the job would be skipped for a neutron
678 patchset for the stable/juno branch provided that every file in the
679 change matched at least one of the specified file regexes. The job
680 will also be skipped for any patchset that modified only the doc
681 tree or rst files.
682
683 *project* (optional)
684 The regular expression to match against the project of the change.
685
686 *branch* (optional)
687 The regular expression to match against the branch or ref of the
688 change.
689
690 *all-files-match-any* (optional)
691 A list of regular expressions intended to match the files involved
692 in the change. This parameter will be considered matching a
693 change only if all files in a change match at least one of these
694 expressions.
695
696 The pattern for '/COMMIT_MSG' is always matched on and does not
Alexander Evseevdbe6fab2015-11-19 12:46:34 +0300697 have to be included. Exception is merge commits (without modified
698 files), in this case '/COMMIT_MSG' is not matched, and job is not
699 skipped. In case of merge commits it's assumed that list of modified
700 files isn't predictible and CI should be run.
Maru Newby3fe5f852015-01-13 04:22:14 +0000701
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400702**voting (optional)**
703 Boolean value (``true`` or ``false``) that indicates whatever
704 a job is voting or not. Default: ``true``.
705
Paul Belanger71d98172016-11-08 10:56:31 -0500706**attempts (optional)**
Paul Belanger174a8272017-03-14 13:20:10 -0400707 Number of attempts zuul will execute a job. Once reached, zuul will report
Paul Belanger71d98172016-11-08 10:56:31 -0500708 RETRY_LIMIT as the job result.
709 Defaults to 3.
710
James E. Blair456f2fb2016-02-09 09:29:33 -0800711**tags (optional)**
712 A list of arbitrary strings which will be associated with the job.
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700713
James E. Blaircdd00072012-06-08 19:17:28 -0700714Here is an example of setting the failure message for jobs that check
715whether a change merges cleanly::
716
717 - name: ^.*-merge$
Jeremy Stanley1c2c3c22015-06-15 21:23:19 +0000718 failure-message: This change or one of its cross-repo dependencies
719 was unable to be automatically merged with the current state of
720 its repository. Please rebase the change and upload a new
721 patchset.
James E. Blaircdd00072012-06-08 19:17:28 -0700722
723Projects
724""""""""
725
Clark Boylan00635dc2012-09-19 14:03:08 -0700726The projects section indicates what jobs should be run in each pipeline
James E. Blaircdd00072012-06-08 19:17:28 -0700727for events associated with each project. It contains a list of
728projects. Here is an example::
729
730 - name: example/project
731 check:
732 - project-merge:
733 - project-unittest
Clark Boylan00635dc2012-09-19 14:03:08 -0700734 - project-pep8
735 - project-pyflakes
James E. Blaircdd00072012-06-08 19:17:28 -0700736 gate:
737 - project-merge:
738 - project-unittest
Clark Boylan00635dc2012-09-19 14:03:08 -0700739 - project-pep8
740 - project-pyflakes
James E. Blaircdd00072012-06-08 19:17:28 -0700741 post:
742 - project-publish
743
744**name**
745 The name of the project (as known by Gerrit).
746
James E. Blair19deff22013-08-25 13:17:35 -0700747**merge-mode (optional)**
748 An optional value that indicates what strategy should be used to
749 merge changes to this project. Supported values are:
750
751 ** merge-resolve **
752 Equivalent to 'git merge -s resolve'. This corresponds closely to
753 what Gerrit performs (using JGit) for a project if the "Merge if
754 necessary" merge mode is selected and "Automatically resolve
755 conflicts" is checked. This is the default.
756
757 ** merge **
758 Equivalent to 'git merge'.
759
760 ** cherry-pick **
761 Equivalent to 'git cherry-pick'.
762
Clark Boylan00635dc2012-09-19 14:03:08 -0700763This is followed by a section for each of the pipelines defined above.
764Pipelines may be omitted if no jobs should run for this project in a
765given pipeline. Within the pipeline section, the jobs that should be
James E. Blaircdd00072012-06-08 19:17:28 -0700766executed are listed. If a job is entered as a dictionary key, then
767jobs contained within that key are only executed if the key job
768succeeds. In the above example, project-unittest, project-pep8, and
Fredrik Medleyf8aec832015-09-28 13:40:20 +0200769project-pyflakes are only executed if project-merge succeeds.
770Furthermore, project-finaltest is executed only if project-unittest,
771project-pep8 and project-pyflakes all succeed. This can help avoid
772running unnecessary jobs while maximizing parallelism. It is also
773useful when distributing results between jobs.
James E. Blaircdd00072012-06-08 19:17:28 -0700774
James E. Blair18c64442014-03-18 10:14:45 -0700775The special job named ``noop`` is internal to Zuul and will always
776return ``SUCCESS`` immediately. This can be useful if you require
777that all changes be processed by a pipeline but a project has no jobs
778that can be run on it.
779
Andreas Jaegerbcfbf932014-09-29 20:21:44 +0200780.. seealso:: The OpenStack Zuul configuration for a comprehensive example: https://git.openstack.org/cgit/openstack-infra/project-config/tree/zuul/layout.yaml
James E. Blaircdd00072012-06-08 19:17:28 -0700781
Antoine Musso80edd5a2013-02-13 15:37:53 +0100782Project Templates
783"""""""""""""""""
784
Michael Prokop526926a2013-10-24 16:16:57 +0200785Whenever you have lot of similar projects (such as plugins for a project) you
Antoine Musso80edd5a2013-02-13 15:37:53 +0100786will most probably want to use the same pipeline configurations. The
787project templates let you define pipelines and job name templates to trigger.
788One can then just apply the template on its project which make it easier to
Michael Prokop526926a2013-10-24 16:16:57 +0200789update several similar projects. As an example::
Antoine Musso80edd5a2013-02-13 15:37:53 +0100790
791 project-templates:
792 # Name of the template
793 - name: plugin-triggering
794 # Definition of pipelines just like for a `project`
795 check:
796 - '{jobprefix}-merge':
797 - '{jobprefix}-pep8'
798 - '{jobprefix}-pyflakes'
799 gate:
800 - '{jobprefix}-merge':
801 - '{jobprefix}-unittest'
802 - '{jobprefix}-pep8'
803 - '{jobprefix}-pyflakes'
804
805In your projects definition, you will then apply the template using the template
806key::
807
808 projects:
809 - name: plugin/foobar
810 template:
811 - name: plugin-triggering
812 jobprefix: plugin-foobar
813
James E. Blairaea6cf62013-12-16 15:38:12 -0800814You can pass several parameters to a template. A ``parameter`` value
815will be used for expansion of ``{parameter}`` in the template
816strings. The parameter ``name`` will be automatically provided and
817will contain the short name of the project, that is the portion of the
818project name after the last ``/`` character.
James E. Blaircdd00072012-06-08 19:17:28 -0700819
James E. Blair3e98c022013-12-16 15:25:38 -0800820Multiple templates can be combined in a project, and the jobs from all
821of those templates will be added to the project. Individual jobs may
822also be added::
823
824 projects:
825 - name: plugin/foobar
826 template:
827 - name: plugin-triggering
828 jobprefix: plugin-foobar
829 - name: plugin-extras
830 jobprefix: plugin-foobar
831 check:
832 - foobar-extra-special-job
833
Steven Dake21ef9ad2014-08-25 23:08:14 -0700834Individual jobs may optionally be added to pipelines (e.g. check,
Atsushi SAKAI5d7e93b2015-07-28 22:15:48 +0900835gate, et cetera) for a project, in addition to those provided by
Steven Dake21ef9ad2014-08-25 23:08:14 -0700836templates.
837
James E. Blair3e98c022013-12-16 15:25:38 -0800838The order of the jobs listed in the project (which only affects the
839order of jobs listed on the report) will be the jobs from each
840template in the order listed, followed by any jobs individually listed
841for the project.
842
843Note that if multiple templates are used for a project and one
844template specifies a job that is also specified in another template,
James E. Blair12a92b12014-03-26 11:54:53 -0700845or specified in the project itself, the configuration defined by
846either the last template or the project itself will take priority.
James E. Blair3e98c022013-12-16 15:25:38 -0800847
Tobias Henkel9a0e1942017-03-20 16:16:02 +0100848
849Semaphores
850""""""""""
851
852When using semaphores the maximum value of each one can be specified in their
853respective config repositories. Unspecified semaphores default to 1::
854
855 - semaphore:
856 name: semaphore-foo
857 max: 5
858 - semaphore:
859 name: semaphore-bar
860 max: 3
861
862
James E. Blaircdd00072012-06-08 19:17:28 -0700863logging.conf
864~~~~~~~~~~~~
865This file is optional. If provided, it should be a standard
866:mod:`logging.config` module configuration file. If not present, Zuul will
867output all log messages of DEBUG level or higher to the console.
868
869Starting Zuul
870-------------
871
872To start Zuul, run **zuul-server**::
873
Antoine Mussob3aa8282013-04-19 15:16:59 +0200874 usage: zuul-server [-h] [-c CONFIG] [-l LAYOUT] [-d] [-t] [--version]
James E. Blaircdd00072012-06-08 19:17:28 -0700875
876 Project gating system.
877
878 optional arguments:
879 -h, --help show this help message and exit
880 -c CONFIG specify the config file
Antoine Mussob3aa8282013-04-19 15:16:59 +0200881 -l LAYOUT specify the layout file
James E. Blaircdd00072012-06-08 19:17:28 -0700882 -d do not run as a daemon
Antoine Mussob3aa8282013-04-19 15:16:59 +0200883 -t validate layout file syntax
884 --version show zuul version
James E. Blaircdd00072012-06-08 19:17:28 -0700885
886You may want to use the ``-d`` argument while you are initially setting
887up Zuul so you can detect any configuration errors quickly. Under
888normal operation, omit ``-d`` and let Zuul run as a daemon.
889
890If you send signal 1 (SIGHUP) to the zuul-server process, Zuul will
891stop executing new jobs, wait until all executing jobs are finished,
Joshua Heskethc4997152016-02-17 21:04:18 +1100892reload its layout.yaml, and resume. Changes to any connections or
893the PID file will be ignored until Zuul is restarted.
Clark Boylanf231fa22013-02-08 12:28:53 -0800894
895If you send a SIGUSR1 to the zuul-server process, Zuul will stop
896executing new jobs, wait until all executing jobs are finished,
897then exit. While waiting to exit Zuul will queue Gerrit events and
898save these events prior to exiting. When Zuul starts again it will
899read these saved events and act on them.
Jeremy Stanley93e05f42013-03-08 17:29:17 +0000900
Michael Prokop526926a2013-10-24 16:16:57 +0200901If you need to abort Zuul and intend to manually requeue changes for
Jeremy Stanley93e05f42013-03-08 17:29:17 +0000902jobs which were running in its pipelines, prior to terminating you can
903use the zuul-changes.py tool script to simplify the process. For
Ramy Asselindda8e6a2015-03-31 14:59:39 -0700904example, this would give you a list of zuul-enqueue commands to requeue
905changes for the gate and check pipelines respectively::
Jeremy Stanley93e05f42013-03-08 17:29:17 +0000906
Ramy Asselindda8e6a2015-03-31 14:59:39 -0700907 ./tools/zuul-changes.py http://zuul.openstack.org/ gate
908 ./tools/zuul-changes.py http://zuul.openstack.org/ check
Clark Boylanfba9b242013-08-20 10:11:17 -0700909
Antoine Musso29eab012014-10-28 21:35:22 +0100910If you send a SIGUSR2 to the zuul-server process, or the forked process
911that runs the Gearman daemon, Zuul will dump a stack trace for each
912running thread into its debug log. It is written under the log bucket
913``zuul.stack_dump``. This is useful for tracking down deadlock or
914otherwise slow threads.
Antoine Mussod0f06262014-06-04 09:54:24 +0200915
916When `yappi <https://code.google.com/p/yappi/>`_ (Yet Another Python
917Profiler) is available, additional functions' and threads' stats are
918emitted as well. The first SIGUSR2 will enable yappi, on the second
919SIGUSR2 it dumps the information collected, resets all yappi state and
920stops profiling. This is to minimize the impact of yappi on a running
921system.