blob: d597f235d36da5f551bba5c9eca76635c659f4a0 [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
Łukasz Jernaś048acb42014-03-02 18:49:41 +010013 other config files.
James E. Blaircdd00072012-06-08 19:17:28 -070014**layout.yaml**
Łukasz Jernaś048acb42014-03-02 18:49:41 +010015 Project and pipeline configuration -- what Zuul does.
James E. Blaircdd00072012-06-08 19:17:28 -070016**logging.conf**
Łukasz Jernaś048acb42014-03-02 18:49:41 +010017 Python logging config.
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
44**server**
James E. Blair1f4c2bb2013-04-26 08:40:46 -070045 Hostname or IP address of the Gearman server.
46 ``server=gearman.example.com``
Clark Boylan9b670902012-09-28 13:47:56 -070047
James E. Blair1f4c2bb2013-04-26 08:40:46 -070048**port**
Łukasz Jernaś048acb42014-03-02 18:49:41 +010049 Port on which the Gearman server is listening.
James E. Blair1f4c2bb2013-04-26 08:40:46 -070050 ``port=4730``
Clark Boylan9b670902012-09-28 13:47:56 -070051
James E. Blair77cc7b82013-07-15 13:22:37 -070052gearman_server
53""""""""""""""
54
55**start**
56 Whether to start the internal Gearman server (default: False).
57 ``start=true``
58
James E. Blair0ac452e2015-07-22 09:05:16 -070059**listen_address**
60 IP address or domain name on which to listen (default: all addresses).
61 ``listen_address=127.0.0.1``
62
James E. Blair77cc7b82013-07-15 13:22:37 -070063**log_config**
64 Path to log config file for internal Gearman server.
65 ``log_config=/etc/zuul/gearman-logging.yaml``
66
Clark Boylan9b670902012-09-28 13:47:56 -070067gerrit
68""""""
69
70**server**
71 FQDN of Gerrit server.
72 ``server=review.example.com``
73
Akihiro Motokic7d28a72014-03-22 09:21:38 +090074**port**
75 Optional: Gerrit server port.
76 ``port=29418``
77
Antoine Musso27475012012-11-26 09:53:01 +010078**baseurl**
79 Optional: path to Gerrit web interface. Defaults to ``https://<value
80 of server>/``. ``baseurl=https://review.example.com/review_site/``
81
Clark Boylan9b670902012-09-28 13:47:56 -070082**user**
83 User name to use when logging into above server via ssh.
James E. Blair1f4c2bb2013-04-26 08:40:46 -070084 ``user=zuul``
Clark Boylan9b670902012-09-28 13:47:56 -070085
86**sshkey**
87 Path to SSH key to use when logging into above server.
James E. Blair1f4c2bb2013-04-26 08:40:46 -070088 ``sshkey=/home/zuul/.ssh/id_rsa``
Clark Boylan9b670902012-09-28 13:47:56 -070089
90zuul
91""""
92
Antoine Musso9adc6d42014-11-14 15:37:48 +010093.. _layout_config:
94
Clark Boylan9b670902012-09-28 13:47:56 -070095**layout_config**
James E. Blair4076e2b2014-01-28 12:42:20 -080096 Path to layout config file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -070097 ``layout_config=/etc/zuul/layout.yaml``
98
99**log_config**
James E. Blaira4430132014-02-17 08:32:07 -0800100 Path to log config file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -0700101 ``log_config=/etc/zuul/logging.yaml``
102
103**pidfile**
James E. Blaira4430132014-02-17 08:32:07 -0800104 Path to PID lock file. Used by zuul-server only.
Clark Boylan9b670902012-09-28 13:47:56 -0700105 ``pidfile=/var/run/zuul/zuul.pid``
106
107**state_dir**
James E. Blair4076e2b2014-01-28 12:42:20 -0800108 Path to directory that Zuul should save state to. Used by all Zuul
109 commands.
Clark Boylan9b670902012-09-28 13:47:56 -0700110 ``state_dir=/var/lib/zuul``
111
James E. Blair4076e2b2014-01-28 12:42:20 -0800112**report_times**
113 Boolean value (``true`` or ``false``) that determines if Zuul should
114 include elapsed times for each job in the textual report. Used by
115 zuul-server only.
116 ``report_times=true``
117
118**status_url**
119 URL that will be posted in Zuul comments made to Gerrit changes when
120 starting jobs for a change. Used by zuul-server only.
121 ``status_url=https://zuul.example.com/status``
122
Clark Boylane0b4bdb2014-06-03 17:01:25 -0700123**status_expiry**
124 Zuul will cache the status.json file for this many seconds. This is an
125 optional value and ``1`` is used by default.
126 ``status_expiry=1``
127
James E. Blair4076e2b2014-01-28 12:42:20 -0800128**url_pattern**
129 If you are storing build logs external to the system that originally
130 ran jobs and wish to link to those logs when Zuul makes comments on
131 Gerrit changes for completed jobs this setting configures what the
132 URLs for those links should be. Used by zuul-server only.
133 ``http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}``
134
135**job_name_in_report**
136 Boolean value (``true`` or ``false``) that indicates whether the
137 job name should be included in the report (normally only the URL
138 is included). Defaults to ``false``. Used by zuul-server only.
139 ``job_name_in_report=true``
140
141merger
142""""""
143
Clark Boylan9b670902012-09-28 13:47:56 -0700144**git_dir**
145 Directory that Zuul should clone local git repositories to.
146 ``git_dir=/var/lib/zuul/git``
147
Paul Belangerb67aba12013-05-13 19:22:14 -0400148**git_user_email**
149 Optional: Value to pass to `git config user.email`.
150 ``git_user_email=zuul@example.com``
151
152**git_user_name**
153 Optional: Value to pass to `git config user.name`.
154 ``git_user_name=zuul``
155
Arx Cruzb1b010d2013-10-28 19:49:59 -0200156**zuul_url**
James E. Blair4076e2b2014-01-28 12:42:20 -0800157 URL of this merger's git repos, accessible to test workers. Usually
158 "http://zuul.example.com/p" or "http://zuul-merger01.example.com/p"
159 depending on whether the merger is co-located with the Zuul server.
Arx Cruzb1b010d2013-10-28 19:49:59 -0200160
James E. Blaira4430132014-02-17 08:32:07 -0800161**log_config**
162 Path to log config file for the merger process.
163 ``log_config=/etc/zuul/logging.yaml``
164
165**pidfile**
166 Path to PID lock file for the merger process.
167 ``pidfile=/var/run/zuul-merger/merger.pid``
168
Joshua Hesketh5fea8672013-08-19 17:32:01 +1000169smtp
170""""
171
172**server**
173 SMTP server hostname or address to use.
174 ``server=localhost``
175
Akihiro Motokic7d28a72014-03-22 09:21:38 +0900176**port**
177 Optional: SMTP server port.
178 ``port=25``
179
Joshua Hesketh5fea8672013-08-19 17:32:01 +1000180**default_from**
181 Who the email should appear to be sent from when emailing the report.
182 This can be overridden by individual pipelines.
183 ``default_from=zuul@example.com``
184
185**default_to**
186 Who the report should be emailed to by default.
187 This can be overridden by individual pipelines.
188 ``default_to=you@example.com``
189
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100190.. _swift:
191
192swift
193"""""
194
195To send (optional) swift upload instructions this section must be
Antoine Musso62fa2d42014-06-04 22:55:23 +0200196present. Multiple destinations can be defined in the :ref:`jobs` section
197of the layout.
198
199If you are sending the temp-url-key or fetching the x-storage-url, you
200will need the python-swiftclient module installed.
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100201
Joshua Heskethc4967502014-05-15 06:39:14 -0700202**X-Account-Meta-Temp-Url-Key** (optional)
203 This is the key used to sign the HMAC message. If you do not set a
204 key Zuul will generate one automatically.
205
206**Send-Temp-Url-Key** (optional)
207 Zuul can send the X-Account-Meta-Temp-Url-Key to swift for you if
208 you have set up the appropriate credentials in ``authurl`` below.
209 This isn't necessary if you know and have set your
210 X-Account-Meta-Temp-Url-Key.
Antoine Musso62fa2d42014-06-04 22:55:23 +0200211 If set, Zuul requires the python-swiftclient module.
Joshua Heskethc4967502014-05-15 06:39:14 -0700212 ``default: true``
213
214**X-Storage-Url** (optional)
215 The storage URL is the destination to upload files into. If you do
216 not set this the ``authurl`` credentials are used to fetch the url
Antoine Musso62fa2d42014-06-04 22:55:23 +0200217 from swift and Zuul will requires the python-swiftclient module.
Joshua Heskethc4967502014-05-15 06:39:14 -0700218
219**authurl** (optional)
220 The (keystone) Auth URL for swift.
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100221 ``For example, https://identity.api.rackspacecloud.com/v2.0/``
Joshua Heskethc4967502014-05-15 06:39:14 -0700222 This is required if you have Send-Temp-Url-Key set to ``True`` or
223 if you have not supplied the X-Storage-Url.
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100224
225Any of the `swiftclient connection parameters`_ can also be defined
226here by the same name. Including the os_options by their key name (
227``for example tenant_id``)
228
229.. _swiftclient connection parameters: http://docs.openstack.org/developer/python-swiftclient/swiftclient.html#module-swiftclient.client
230
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100231**region_name** (optional)
232 The region name holding the swift container
233 ``For example, SYD``
234
235Each destination defined by the :ref:`jobs` will have the following
236default values that it may overwrite.
237
238**default_container** (optional)
239 Container name to place the log into
240 ``For example, logs``
241
242**default_expiry** (optional)
243 How long the signed destination should be available for
244 ``default: 7200 (2hrs)``
245
246**default_max_file_size** (optional)
247 The maximum size of an individual file
248 ``default: 104857600 (100MB)``
249
250**default_max_file_count** (optional)
251 The maximum number of separate files to allow
252 ``default: 10``
253
254**default_logserver_prefix**
255 Provide a URL to the CDN or logserver app so that a worker knows
256 what URL to return. The worker should return the logserver_prefix
257 url and the object path.
258 ``For example: http://logs.example.org/server.app?obj=``
259
James E. Blaircdd00072012-06-08 19:17:28 -0700260layout.yaml
261~~~~~~~~~~~
262
Clark Boylan00635dc2012-09-19 14:03:08 -0700263This is the main configuration file for Zuul, where all of the pipelines
James E. Blaircdd00072012-06-08 19:17:28 -0700264and projects are defined, what tests should be run, and what actions
Clark Boylan00635dc2012-09-19 14:03:08 -0700265Zuul should perform. There are three sections: pipelines, jobs, and
James E. Blaircdd00072012-06-08 19:17:28 -0700266projects.
267
James E. Blaire5a847f2012-07-10 15:29:14 -0700268.. _includes:
269
270Includes
271""""""""
272
273Custom functions to be used in Zuul's configuration may be provided
274using the ``includes`` directive. It accepts a list of files to
275include, and currently supports one type of inclusion, a python file::
276
277 includes:
278 - python-file: local_functions.py
279
280**python-file**
Antoine Musso9adc6d42014-11-14 15:37:48 +0100281 The path to a python file (either an absolute path or relative to the
282 directory name of :ref:`layout_config <layout_config>`). The
283 file will be loaded and objects that it defines will be placed in a
284 special environment which can be referenced in the Zuul configuration.
285 Currently only the parameter-function attribute of a Job uses this
286 feature.
James E. Blaire5a847f2012-07-10 15:29:14 -0700287
Clark Boylan00635dc2012-09-19 14:03:08 -0700288Pipelines
289"""""""""
James E. Blaircdd00072012-06-08 19:17:28 -0700290
Clark Boylan00635dc2012-09-19 14:03:08 -0700291Zuul can have any number of independent pipelines. Whenever a matching
292Gerrit event is found for a pipeline, that event is added to the
293pipeline, and the jobs specified for that pipeline are run. When all
294jobs specified for the pipeline that were triggered by an event are
295completed, Zuul reports back to Gerrit the results.
James E. Blaircdd00072012-06-08 19:17:28 -0700296
Clark Boylan00635dc2012-09-19 14:03:08 -0700297There are no pre-defined pipelines in Zuul, rather you can define
298whatever pipelines you need in the layout file. This is a very flexible
299system that can accommodate many kinds of workflows.
James E. Blaircdd00072012-06-08 19:17:28 -0700300
Clark Boylan00635dc2012-09-19 14:03:08 -0700301Here is a quick example of a pipeline definition followed by an
James E. Blaircdd00072012-06-08 19:17:28 -0700302explanation of each of the parameters::
303
304 - name: check
Clark Boylan00635dc2012-09-19 14:03:08 -0700305 manager: IndependentPipelineManager
James E. Blairc0dedf82014-08-06 09:37:52 -0700306 source: gerrit
James E. Blaircdd00072012-06-08 19:17:28 -0700307 trigger:
James E. Blair6c358e72013-07-29 17:06:47 -0700308 gerrit:
309 - event: patchset-created
James E. Blaircdd00072012-06-08 19:17:28 -0700310 success:
311 verified: 1
312 failure:
313 verified: -1
314
315**name**
316 This is used later in the project definition to indicate what jobs
Clark Boylan00635dc2012-09-19 14:03:08 -0700317 should be run for events in the pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700318
James E. Blair8dbd56a2012-12-22 10:55:10 -0800319**description**
320 This is an optional field that may be used to provide a textual
321 description of the pipeline.
322
James E. Blairc0dedf82014-08-06 09:37:52 -0700323**source**
324 A required field that specifies a trigger that provides access to
325 the change objects that this pipeline operates on. Currently only
326 the value ``gerrit`` is supported.
327
James E. Blair56370192013-01-14 15:47:28 -0800328**success-message**
329 An optional field that supplies the introductory text in message
330 reported back to Gerrit when all the voting builds are successful.
331 Defaults to "Build successful."
332
333**failure-message**
334 An optional field that supplies the introductory text in message
335 reported back to Gerrit when at least one voting build fails.
336 Defaults to "Build failed."
337
Joshua Heskethb7179772014-01-30 23:30:46 +1100338**merge-failure-message**
339 An optional field that supplies the introductory text in message
340 reported back to Gerrit when a change fails to merge with the
341 current state of the repository.
342 Defaults to "Merge failed."
343
Joshua Hesketh3979e3e2014-03-04 11:21:10 +1100344**footer-message**
345 An optional field to supply additional information after test results.
346 Useful for adding information about the CI system such as debugging
347 and contact details.
348
James E. Blaircdd00072012-06-08 19:17:28 -0700349**manager**
Clark Boylan00635dc2012-09-19 14:03:08 -0700350 There are currently two schemes for managing pipelines:
James E. Blaircdd00072012-06-08 19:17:28 -0700351
Clark Boylan00635dc2012-09-19 14:03:08 -0700352 *IndependentPipelineManager*
353 Every event in this pipeline should be treated as independent of
354 other events in the pipeline. This is appropriate when the order of
355 events in the pipeline doesn't matter because the results of the
356 actions this pipeline performs can not affect other events in the
357 pipeline. For example, when a change is first uploaded for review,
James E. Blaircdd00072012-06-08 19:17:28 -0700358 you may want to run tests on that change to provide early feedback
359 to reviewers. At the end of the tests, the change is not going to
360 be merged, so it is safe to run these tests in parallel without
Clark Boylan00635dc2012-09-19 14:03:08 -0700361 regard to any other changes in the pipeline. They are independent.
James E. Blaircdd00072012-06-08 19:17:28 -0700362
Clark Boylan00635dc2012-09-19 14:03:08 -0700363 Another type of pipeline that is independent is a post-merge
364 pipeline. In that case, the changes have already merged, so the
365 results can not affect any other events in the pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700366
Clark Boylan00635dc2012-09-19 14:03:08 -0700367 *DependentPipelineManager*
368 The dependent pipeline manager is designed for gating. It ensures
James E. Blaircdd00072012-06-08 19:17:28 -0700369 that every change is tested exactly as it is going to be merged
370 into the repository. An ideal gating system would test one change
371 at a time, applied to the tip of the repository, and only if that
372 change passed tests would it be merged. Then the next change in
373 line would be tested the same way. In order to achieve parallel
Clark Boylan00635dc2012-09-19 14:03:08 -0700374 testing of changes, the dependent pipeline manager performs
James E. Blaircdd00072012-06-08 19:17:28 -0700375 speculative execution on changes. It orders changes based on
Clark Boylan00635dc2012-09-19 14:03:08 -0700376 their entry into the pipeline. It begins testing all changes in
377 parallel, assuming that each change ahead in the pipeline will pass
James E. Blaircdd00072012-06-08 19:17:28 -0700378 its tests. If they all succeed, all the changes can be tested and
Clark Boylan00635dc2012-09-19 14:03:08 -0700379 merged in parallel. If a change near the front of the pipeline
380 fails its tests, each change behind it ignores whatever tests have
381 been completed and are tested again without the change in front.
382 This way gate tests may run in parallel but still be tested
383 correctly, exactly as they will appear in the repository when
384 merged.
James E. Blaircdd00072012-06-08 19:17:28 -0700385
Clark Boylan00635dc2012-09-19 14:03:08 -0700386 One important characteristic of the DependentPipelineManager is that
James E. Blaircdd00072012-06-08 19:17:28 -0700387 it analyzes the jobs that are triggered by different projects, and
388 if those projects have jobs in common, it treats those projects as
389 related, and they share a single virtual queue of changes. Thus,
390 if there is a job that performs integration testing on two
391 projects, those two projects will automatically share a virtual
392 change queue. If a third project does not invoke that job, it
Clark Boylan00635dc2012-09-19 14:03:08 -0700393 will be part of a separate virtual change queue, and changes to
394 it will not depend on changes to the first two jobs.
James E. Blaircdd00072012-06-08 19:17:28 -0700395
396 For more detail on the theory and operation of Zuul's
Clark Boylan00635dc2012-09-19 14:03:08 -0700397 DependentPipelineManager, see: :doc:`gating`.
James E. Blaircdd00072012-06-08 19:17:28 -0700398
399**trigger**
James E. Blairc494d542014-08-06 09:23:52 -0700400 At least one trigger source must be supplied for each pipeline.
James E. Blaircdd00072012-06-08 19:17:28 -0700401 Triggers are not exclusive -- matching events may be placed in
James E. Blair6c358e72013-07-29 17:06:47 -0700402 multiple pipelines, and they will behave independently in each of
403 the pipelines they match. You may select from the following:
James E. Blaircdd00072012-06-08 19:17:28 -0700404
James E. Blair6c358e72013-07-29 17:06:47 -0700405 **gerrit**
406 This describes what Gerrit events should be placed in the
407 pipeline. Multiple gerrit triggers may be listed. Further
408 parameters describe the kind of events that match:
James E. Blaircdd00072012-06-08 19:17:28 -0700409
James E. Blair6c358e72013-07-29 17:06:47 -0700410 *event*
411 The event name from gerrit. Examples: ``patchset-created``,
412 ``comment-added``, ``ref-updated``. This field is treated as a
413 regular expression.
James E. Blaircdd00072012-06-08 19:17:28 -0700414
James E. Blair6c358e72013-07-29 17:06:47 -0700415 *branch*
416 The branch associated with the event. Example: ``master``. This
417 field is treated as a regular expression, and multiple branches may
418 be listed.
James E. Blaircdd00072012-06-08 19:17:28 -0700419
James E. Blair6c358e72013-07-29 17:06:47 -0700420 *ref*
421 On ref-updated events, the branch parameter is not used, instead the
422 ref is provided. Currently Gerrit has the somewhat idiosyncratic
423 behavior of specifying bare refs for branch names (e.g., ``master``),
424 but full ref names for other kinds of refs (e.g., ``refs/tags/foo``).
425 Zuul matches what you put here exactly against what Gerrit
426 provides. This field is treated as a regular expression, and
427 multiple refs may be listed.
James E. Blaircdd00072012-06-08 19:17:28 -0700428
K Jonathan Harkerf95e7232015-04-29 13:33:16 -0700429 *ignore-deletes*
430 When a branch is deleted, a ref-updated event is emitted with a newrev
431 of all zeros specified. The ``ignore-deletes`` field is a boolean value
432 that describes whether or not these newrevs trigger ref-updated events.
433 The default is True, which will not trigger ref-updated events.
434
James E. Blair6c358e72013-07-29 17:06:47 -0700435 *approval*
436 This is only used for ``comment-added`` events. It only matches if
437 the event has a matching approval associated with it. Example:
438 ``code-review: 2`` matches a ``+2`` vote on the code review category.
439 Multiple approvals may be listed.
Antoine Mussob4e809e2012-12-06 16:58:06 +0100440
James E. Blair1fbfceb2014-06-23 14:42:53 -0700441 *email*
James E. Blair6c358e72013-07-29 17:06:47 -0700442 This is used for any event. It takes a regex applied on the performer
Michael Prokop526926a2013-10-24 16:16:57 +0200443 email, i.e. Gerrit account email address. If you want to specify
James E. Blair6c358e72013-07-29 17:06:47 -0700444 several email filters, you must use a YAML list. Make sure to use non
445 greedy matchers and to escapes dots!
James E. Blair1fbfceb2014-06-23 14:42:53 -0700446 Example: ``email: ^.*?@example\.org$``.
James E. Blair6c358e72013-07-29 17:06:47 -0700447
James E. Blair1fbfceb2014-06-23 14:42:53 -0700448 *email_filter* (deprecated)
449 A deprecated alternate spelling of *email*. Only one of *email* or
450 *email_filter* should be used.
451
452 *username*
Joshua Heskethb8a817e2013-12-27 11:21:38 +1100453 This is used for any event. It takes a regex applied on the performer
454 username, i.e. Gerrit account name. If you want to specify several
455 username filters, you must use a YAML list. Make sure to use non greedy
456 matchers and to escapes dots!
James E. Blair1fbfceb2014-06-23 14:42:53 -0700457 Example: ``username: ^jenkins$``.
Joshua Heskethb8a817e2013-12-27 11:21:38 +1100458
James E. Blair1fbfceb2014-06-23 14:42:53 -0700459 *username_filter* (deprecated)
460 A deprecated alternate spelling of *username*. Only one of *username* or
461 *username_filter* should be used.
462
463 *comment*
James E. Blair6c358e72013-07-29 17:06:47 -0700464 This is only used for ``comment-added`` events. It accepts a list of
465 regexes that are searched for in the comment string. If any of these
466 regexes matches a portion of the comment string the trigger is
James E. Blair1fbfceb2014-06-23 14:42:53 -0700467 matched. ``comment: retrigger`` will match when comments
James E. Blair6c358e72013-07-29 17:06:47 -0700468 containing 'retrigger' somewhere in the comment text are added to a
469 change.
Clark Boylanb9bcb402012-06-29 17:44:05 -0700470
James E. Blair1fbfceb2014-06-23 14:42:53 -0700471 *comment_filter* (deprecated)
472 A deprecated alternate spelling of *comment*. Only one of *comment* or
473 *comment_filter* should be used.
474
James E. Blair5bf78a32015-07-30 18:08:24 +0000475 *require-approval*
James E. Blairc053d022014-01-22 14:57:33 -0800476 This may be used for any event. It requires that a certain kind
477 of approval be present for the current patchset of the change (the
James E. Blair11041d22014-05-02 14:49:53 -0700478 approval could be added by the event in question). It follows the
Antoine Musso27ab0d52014-10-22 14:20:17 +0200479 same syntax as the :ref:`"approval" pipeline requirement below
480 <pipeline-require-approval>`.
James E. Blairc053d022014-01-22 14:57:33 -0800481
James E. Blair63bb0ef2013-07-29 17:14:51 -0700482 **timer**
483 This trigger will run based on a cron-style time specification.
484 It will enqueue an event into its pipeline for every project
485 defined in the configuration. Any job associated with the
486 pipeline will run in response to that event.
487
488 *time*
489 The time specification in cron syntax. Only the 5 part syntax is
490 supported, not the symbolic names. Example: ``0 0 * * *`` runs
491 at midnight.
492
James E. Blairc494d542014-08-06 09:23:52 -0700493 **zuul**
494 This trigger supplies events generated internally by Zuul.
495 Multiple events may be listed.
496
497 *event*
498 The event name. Currently supported:
499
500 *project-change-merged* when Zuul merges a change to a project,
501 it generates this event for every open change in the project.
502
503 *parent-change-enqueued* when Zuul enqueues a change into any
504 pipeline, it generates this event for every child of that
505 change.
506
507 *pipeline*
508 Only available for ``parent-change-enqueued`` events. This is the
509 name of the pipeline in which the parent change was enqueued.
510
511 *require-approval*
512 This may be used for any event. It requires that a certain kind
513 of approval be present for the current patchset of the change (the
514 approval could be added by the event in question). It follows the
Antoine Musso27ab0d52014-10-22 14:20:17 +0200515 same syntax as the :ref:`"approval" pipeline requirement below
516 <pipeline-require-approval>`.
James E. Blairc494d542014-08-06 09:23:52 -0700517
518
James E. Blair11041d22014-05-02 14:49:53 -0700519**require**
520 If this section is present, it established pre-requisites for any
521 kind of item entering the Pipeline. Regardless of how the item is
522 to be enqueued (via any trigger or automatic dependency resolution),
523 the conditions specified here must be met or the item will not be
524 enqueued.
525
Antoine Musso27ab0d52014-10-22 14:20:17 +0200526.. _pipeline-require-approval:
527
James E. Blair5bf78a32015-07-30 18:08:24 +0000528 **approval**
James E. Blair11041d22014-05-02 14:49:53 -0700529 This requires that a certain kind of approval be present for the
530 current patchset of the change (the approval could be added by the
531 event in question). It takes several sub-parameters, all of which
532 are optional and are combined together so that there must be an
533 approval matching all specified requirements.
534
535 *username*
536 If present, an approval from this username is required.
537
James E. Blair1fbfceb2014-06-23 14:42:53 -0700538 *email*
James E. Blair11041d22014-05-02 14:49:53 -0700539 If present, an approval with this email address is required. It
540 is treated as a regular expression as above.
541
James E. Blair1fbfceb2014-06-23 14:42:53 -0700542 *email-filter* (deprecated)
543 A deprecated alternate spelling of *email*. Only one of *email* or
544 *email_filter* should be used.
545
James E. Blair11041d22014-05-02 14:49:53 -0700546 *older-than*
547 If present, the approval must be older than this amount of time
548 to match. Provide a time interval as a number with a suffix of
549 "w" (weeks), "d" (days), "h" (hours), "m" (minutes), "s"
550 (seconds). Example ``48h`` or ``2d``.
551
552 *newer-than*
553 If present, the approval must be newer than this amount of time
554 to match. Same format as "older-than".
555
556 Any other field is interpreted as a review category and value
557 pair. For example ``verified: 1`` would require that the approval
James E. Blair9c17dbf2014-06-23 14:21:58 -0700558 be for a +1 vote in the "Verified" column. The value may either
559 be a single value or a list: ``verified: [1, 2]`` would match
560 either a +1 or +2 vote.
James E. Blair11041d22014-05-02 14:49:53 -0700561
562 **open**
563 A boolean value (``true`` or ``false``) that indicates whether the change
564 must be open or closed in order to be enqueued.
565
Clark Boylana9702ad2014-05-08 17:17:24 -0700566 **current-patchset**
567 A boolean value (``true`` or ``false``) that indicates whether the change
568 must be the current patchset in order to be enqueued.
569
James E. Blair11041d22014-05-02 14:49:53 -0700570 **status**
571 A string value that corresponds with the status of the change
572 reported by the trigger. For example, when using the Gerrit
573 trigger, status values such as ``NEW`` or ``MERGED`` may be useful.
James E. Blair63bb0ef2013-07-29 17:14:51 -0700574
James E. Blair2fa50962013-01-30 21:50:41 -0800575**dequeue-on-new-patchset**
576 Normally, if a new patchset is uploaded to a change that is in a
577 pipeline, the existing entry in the pipeline will be removed (with
578 jobs canceled and any dependent changes that can no longer merge as
579 well. To suppress this behavior (and allow jobs to continue
580 running), set this to ``false``. Default: ``true``.
581
James E. Blair17dd6772015-02-09 14:45:18 -0800582**ignore-dependencies**
583 In any kind of pipeline (dependent or independent), Zuul will
584 attempt to enqueue all dependencies ahead of the current change so
585 that they are tested together (independent pipelines report the
586 results of each change regardless of the results of changes ahead).
587 To ignore dependencies completely in an independent pipeline, set
588 this to ``true``. This option is ignored by dependent pipelines.
589 The default is: ``false``.
590
James E. Blaircdd00072012-06-08 19:17:28 -0700591**success**
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000592 Describes where Zuul should report to if all the jobs complete
593 successfully.
James E. Blaircdd00072012-06-08 19:17:28 -0700594 This section is optional; if it is omitted, Zuul will run jobs and
595 do nothing on success; it will not even report a message to Gerrit.
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000596 If the section is present, the listed reporter plugins will be
597 asked to report on the jobs.
598 Each reporter's value dictionary is handled by the reporter. See
599 reporters for more details.
James E. Blaircdd00072012-06-08 19:17:28 -0700600
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400601**failure**
James E. Blaircdd00072012-06-08 19:17:28 -0700602 Uses the same syntax as **success**, but describes what Zuul should
603 do if at least one job fails.
James E. Blairdc253862012-06-13 17:12:42 -0700604
Joshua Heskethb7179772014-01-30 23:30:46 +1100605**merge-failure**
606 Uses the same syntax as **success**, but describes what Zuul should
607 do if it is unable to merge in the patchset. If no merge-failure
608 reporters are listed then the ``failure`` reporters will be used to
609 notify of unsuccessful merges.
610
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400611**start**
James E. Blairdc253862012-06-13 17:12:42 -0700612 Uses the same syntax as **success**, but describes what Zuul should
Clark Boylan00635dc2012-09-19 14:03:08 -0700613 do when a change is added to the pipeline manager. This can be used,
James E. Blairdc253862012-06-13 17:12:42 -0700614 for example, to reset the value of the Verified review category.
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400615
Joshua Hesketh89e829d2015-02-10 16:29:45 +1100616**disabled**
617 Uses the same syntax as **success**, but describes what Zuul should
618 do when a pipeline is disabled.
619 See ``disable-after-consecutive-failures``.
620
621**disable-after-consecutive-failures**
622 If set, a pipeline can enter a ''disabled'' state if too many changes
623 in a row fail. When this value is exceeded the pipeline will stop
624 reporting to any of the ``success``, ``failure`` or ``merge-failure``
625 reporters and instead only report to the ``disabled`` reporters.
626 (No ``start`` reports are made when a pipeline is disabled).
627
James E. Blair64ed6f22013-07-10 14:07:23 -0700628**precedence**
629 Indicates how the build scheduler should prioritize jobs for
630 different pipelines. Each pipeline may have one precedence, jobs
631 for pipelines with a higher precedence will be run before ones with
632 lower. The value should be one of ``high``, ``normal``, or ``low``.
633 Default: ``normal``.
634
Clark Boylanc2d19e42014-01-23 14:08:58 -0800635**window**
636 DependentPipelineManagers only. Zuul can rate limit
637 DependentPipelineManagers in a manner similar to TCP flow control.
638 Jobs are only started for changes in the queue if they sit in the
639 actionable window for the pipeline. The initial length of this window
640 is configurable with this value. The value given should be a positive
641 integer value. A value of ``0`` disables rate limiting on the
642 DependentPipelineManager.
643 Default: ``20``.
644
645**window-floor**
646 DependentPipelineManagers only. This is the minimum value for the
647 window described above. Should be a positive non zero integer value.
648 Default: ``3``.
649
650**window-increase-type**
651 DependentPipelineManagers only. This value describes how the window
652 should grow when changes are successfully merged by zuul. A value of
653 ``linear`` indicates that ``window-increase-factor`` should be added
654 to the previous window value. A value of ``exponential`` indicates
655 that ``window-increase-factor`` should be multiplied against the
656 previous window value and the result will become the window size.
657 Default: ``linear``.
658
659**window-increase-factor**
Clint Adams041ae512015-06-16 20:02:29 -0400660 DependentPipelineManagers only. The value to be added or multiplied
Clark Boylanc2d19e42014-01-23 14:08:58 -0800661 against the previous window value to determine the new window after
662 successful change merges.
663 Default: ``1``.
664
665**window-decrease-type**
666 DependentPipelineManagers only. This value describes how the window
667 should shrink when changes are not able to be merged by Zuul. A value
668 of ``linear`` indicates that ``window-decrease-factor`` should be
669 subtracted from the previous window value. A value of ``exponential``
670 indicates that ``window-decrease-factor`` should be divided against
671 the previous window value and the result will become the window size.
672 Default: ``exponential``.
673
674**window-decrease-factor**
675 DependentPipelineManagers only. The value to be subtracted or divided
676 against the previous window value to determine the new window after
677 unsuccessful change merges.
678 Default: ``2``.
679
Clark Boylan00635dc2012-09-19 14:03:08 -0700680Some example pipeline configurations are included in the sample layout
681file. The first is called a *check* pipeline::
James E. Blaircdd00072012-06-08 19:17:28 -0700682
683 - name: check
Clark Boylan00635dc2012-09-19 14:03:08 -0700684 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700685 trigger:
686 - event: patchset-created
687 success:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000688 gerrit:
689 verified: 1
James E. Blaircdd00072012-06-08 19:17:28 -0700690 failure:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000691 gerrit:
692 verified: -1
James E. Blaircdd00072012-06-08 19:17:28 -0700693
694This will trigger jobs each time a new patchset (or change) is
695uploaded to Gerrit, and report +/-1 values to Gerrit in the
696``verified`` review category. ::
697
698 - name: gate
Clark Boylan00635dc2012-09-19 14:03:08 -0700699 manager: DependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700700 trigger:
701 - event: comment-added
702 approval:
703 - approved: 1
704 success:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000705 gerrit:
706 verified: 2
707 submit: true
James E. Blaircdd00072012-06-08 19:17:28 -0700708 failure:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000709 gerrit:
710 verified: -2
James E. Blaircdd00072012-06-08 19:17:28 -0700711
712This will trigger jobs whenever a reviewer leaves a vote of ``1`` in the
713``approved`` review category in Gerrit (a non-standard category).
714Changes will be tested in such a way as to guarantee that they will be
715merged exactly as tested, though that will happen in parallel by
716creating a virtual queue of dependent changes and performing
717speculative execution of jobs. ::
718
719 - name: post
Clark Boylan00635dc2012-09-19 14:03:08 -0700720 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700721 trigger:
722 - event: ref-updated
723 ref: ^(?!refs/).*$
724
725This will trigger jobs whenever a change is merged to a named branch
726(e.g., ``master``). No output will be reported to Gerrit. This is
727useful for side effects such as creating per-commit tarballs. ::
728
729 - name: silent
Clark Boylan00635dc2012-09-19 14:03:08 -0700730 manager: IndependentPipelineManager
James E. Blaircdd00072012-06-08 19:17:28 -0700731 trigger:
732 - event: patchset-created
733
734This also triggers jobs when changes are uploaded to Gerrit, but no
735results are reported to Gerrit. This is useful for jobs that are in
Antoine Mussoce333842012-10-16 14:42:35 +0200736development and not yet ready to be presented to developers. ::
737
738 pipelines:
739 - name: post-merge
740 manager: IndependentPipelineManager
741 trigger:
742 - event: change-merged
743 success:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000744 gerrit:
745 force-message: True
Antoine Mussoce333842012-10-16 14:42:35 +0200746 failure:
Joshua Hesketh1879cf72013-08-19 14:13:15 +1000747 gerrit:
748 force-message: True
Antoine Mussoce333842012-10-16 14:42:35 +0200749
750The ``change-merged`` events happen when a change has been merged in the git
751repository. The change is thus closed and Gerrit will not accept modifications
752to the review scoring such as ``code-review`` or ``verified``. By using the
753``force-message: True`` parameter, Zuul will pass ``--force-message`` to the
754``gerrit review`` command, thus making sure the message is actually
755sent back to Gerrit regardless of approval scores.
756That kind of pipeline is nice to run regression or performance tests.
757
758.. note::
759 The ``change-merged`` event does not include the commit sha1 which can be
760 hazardous, it would let you report back to Gerrit though. If you were to
Michael Prokop526926a2013-10-24 16:16:57 +0200761 build a tarball for a specific commit, you should consider instead using
Łukasz Jernaś048acb42014-03-02 18:49:41 +0100762 the ``ref-updated`` event which does include the commit sha1 (but lacks the
Antoine Mussoce333842012-10-16 14:42:35 +0200763 Gerrit change number).
James E. Blaircdd00072012-06-08 19:17:28 -0700764
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100765
766.. _jobs:
767
James E. Blaircdd00072012-06-08 19:17:28 -0700768Jobs
769""""
770
771The jobs section is optional, and can be used to set attributes of
772jobs that are independent of their association with a project. For
773example, if a job should return a customized message on failure, that
774may be specified here. Otherwise, Zuul does not need to be told about
775each job as it builds a list from the project specification.
776
777**name**
778 The name of the job. This field is treated as a regular expression
779 and will be applied to each job that matches.
780
James E. Blairc8a1e052014-02-25 09:29:26 -0800781**queue-name (optional)**
782 Zuul will automatically combine projects that share a job into
783 shared change queues for dependent pipeline managers. In order to
784 report statistics about these queues, it is convenient for them to
785 have names. Zuul can automatically name change queues, however
786 these can grow quite long and are prone to changing as projects in
787 the queue change. If you assign a queue-name to a job, Zuul will
788 use that as the name for the shared change queue that contains that
789 job instead of the automatically generated one. It is an error for
790 a shared change queue to have more than one job with a queue-name if
791 they are not the same.
792
James E. Blaire5a847f2012-07-10 15:29:14 -0700793**failure-message (optional)**
794 The message that should be reported to Gerrit if the job fails.
James E. Blaircdd00072012-06-08 19:17:28 -0700795
James E. Blaire5a847f2012-07-10 15:29:14 -0700796**success-message (optional)**
797 The message that should be reported to Gerrit if the job fails.
James E. Blaircdd00072012-06-08 19:17:28 -0700798
James E. Blair6aea36d2012-12-17 13:03:24 -0800799**failure-pattern (optional)**
800 The URL that should be reported to Gerrit if the job fails.
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700801 Defaults to the build URL or the url_pattern configured in
James E. Blair6aea36d2012-12-17 13:03:24 -0800802 zuul.conf. May be supplied as a string pattern with substitutions
803 as described in url_pattern in :ref:`zuulconf`.
804
805**success-pattern (optional)**
806 The URL that should be reported to Gerrit if the job succeeds.
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700807 Defaults to the build URL or the url_pattern configured in
James E. Blair6aea36d2012-12-17 13:03:24 -0800808 zuul.conf. May be supplied as a string pattern with substitutions
809 as described in url_pattern in :ref:`zuulconf`.
810
James E. Blair222d4982012-07-16 09:31:19 -0700811**hold-following-changes (optional)**
812 This is a boolean that indicates that changes that follow this
Clark Boylan00635dc2012-09-19 14:03:08 -0700813 change in a dependent change pipeline should wait until this job
James E. Blair222d4982012-07-16 09:31:19 -0700814 succeeds before launching. If this is applied to a very short job
815 that can predict whether longer jobs will fail early, this can be
816 used to reduce the number of jobs that Zuul will launch and
817 ultimately have to cancel. In that case, a small amount of
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400818 parallelization of jobs is traded for more efficient use of testing
James E. Blair222d4982012-07-16 09:31:19 -0700819 resources. On the other hand, to apply this to a long running job
820 would largely defeat the parallelization of dependent change testing
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400821 that is the main feature of Zuul. Default: ``false``.
James E. Blair222d4982012-07-16 09:31:19 -0700822
James E. Blaire5a847f2012-07-10 15:29:14 -0700823**branch (optional)**
James E. Blaircdd00072012-06-08 19:17:28 -0700824 This job should only be run on matching branches. This field is
825 treated as a regular expression and multiple branches may be
826 listed.
827
James E. Blair70c71582013-03-06 08:50:50 -0800828**files (optional)**
829 This job should only be run if at least one of the files involved in
830 the change (added, deleted, or modified) matches at least one of the
831 file patterns listed here. This field is treated as a regular
832 expression and multiple expressions may be listed.
833
Maru Newby3fe5f852015-01-13 04:22:14 +0000834**skip-if (optional)**
835
836 This job should not be run if all the patterns specified by the
837 optional fields listed below match on their targets. When multiple
838 sets of parameters are provided, this job will be skipped if any set
839 matches. For example: ::
840
841 jobs:
842 - name: check-tempest-dsvm-neutron
843 skip-if:
844 - project: ^openstack/neutron$
845 branch: ^stable/juno$
846 all-files-match-any:
847 - ^neutron/tests/.*$
848 - ^tools/.*$
849 - all-files-match-any:
850 - ^doc/.*$
851 - ^.*\.rst$
852
853 With this configuration, the job would be skipped for a neutron
854 patchset for the stable/juno branch provided that every file in the
855 change matched at least one of the specified file regexes. The job
856 will also be skipped for any patchset that modified only the doc
857 tree or rst files.
858
859 *project* (optional)
860 The regular expression to match against the project of the change.
861
862 *branch* (optional)
863 The regular expression to match against the branch or ref of the
864 change.
865
866 *all-files-match-any* (optional)
867 A list of regular expressions intended to match the files involved
868 in the change. This parameter will be considered matching a
869 change only if all files in a change match at least one of these
870 expressions.
871
872 The pattern for '/COMMIT_MSG' is always matched on and does not
873 have to be included.
874
Mathieu Gagnéd6d2a642013-06-11 20:59:58 -0400875**voting (optional)**
876 Boolean value (``true`` or ``false``) that indicates whatever
877 a job is voting or not. Default: ``true``.
878
James E. Blaire5a847f2012-07-10 15:29:14 -0700879**parameter-function (optional)**
880 Specifies a function that should be applied to the parameters before
881 the job is launched. The function should be defined in a python file
882 included with the :ref:`includes` directive. The function
883 should have the following signature:
884
James E. Blaird0470972013-07-29 10:05:43 -0700885 .. function:: parameters(item, job, parameters)
James E. Blaire5a847f2012-07-10 15:29:14 -0700886
887 Manipulate the parameters passed to a job before a build is
888 launched. The ``parameters`` dictionary will already contain the
889 standard Zuul job parameters, and is expected to be modified
890 in-place.
891
James E. Blaird78576a2013-07-09 10:39:17 -0700892 :param item: the current queue item
893 :type item: zuul.model.QueueItem
James E. Blaird0470972013-07-29 10:05:43 -0700894 :param job: the job about to be run
895 :type job: zuul.model.Job
James E. Blaire5a847f2012-07-10 15:29:14 -0700896 :param parameters: parameters to be passed to the job
897 :type parameters: dict
898
James E. Blair1f4c2bb2013-04-26 08:40:46 -0700899 If the parameter **ZUUL_NODE** is set by this function, then it will
900 be used to specify on what node (or class of node) the job should be
901 run.
902
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100903**swift**
904 If :ref:`swift` is configured then each job can define a destination
905 container for the builder to place logs and/or assets into. Multiple
906 containers can be listed for each job by providing a unique ``name``.
907
908 *name*
909 Set an identifying name for the container. This is used in the
910 parameter key sent to the builder. For example if it ``logs`` then
911 one of the parameters sent will be ``SWIFT_logs_CONTAINER``
912 (case-sensitive).
913
914 Each of the defaults defined in :ref:`swift` can be overwritten as:
915
916 *container* (optional)
917 Container name to place the log into
918 ``For example, logs``
919
920 *expiry* (optional)
921 How long the signed destination should be available for
922
James E. Blaird6500232014-06-23 15:05:48 -0700923 *max-file-size** (optional)
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100924 The maximum size of an individual file
925
James E. Blaird6500232014-06-23 15:05:48 -0700926 *max_file_size** (optional, deprecated)
927 A deprecated alternate spelling of *max-file-size*.
928
929 *max-file-count* (optional)
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100930 The maximum number of separate files to allow
931
James E. Blaird6500232014-06-23 15:05:48 -0700932 *max_file_count* (optional, deprecated)
933 A deprecated alternate spelling of *max-file-count*.
934
935 *logserver-prefix*
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100936 Provide a URL to the CDN or logserver app so that a worker knows
937 what URL to return.
938 ``For example: http://logs.example.org/server.app?obj=``
James E. Blaird6500232014-06-23 15:05:48 -0700939 The worker should return the logserver-prefix url and the object
Joshua Hesketh36c3fa52014-01-22 11:40:52 +1100940 path as the URL in the results data packet.
941
James E. Blaird6500232014-06-23 15:05:48 -0700942 *logserver_prefix* (deprecated)
943 A deprecated alternate spelling of *logserver-prefix*.
944
James E. Blaircdd00072012-06-08 19:17:28 -0700945Here is an example of setting the failure message for jobs that check
946whether a change merges cleanly::
947
948 - name: ^.*-merge$
Jeremy Stanley1c2c3c22015-06-15 21:23:19 +0000949 failure-message: This change or one of its cross-repo dependencies
950 was unable to be automatically merged with the current state of
951 its repository. Please rebase the change and upload a new
952 patchset.
James E. Blaircdd00072012-06-08 19:17:28 -0700953
954Projects
955""""""""
956
Clark Boylan00635dc2012-09-19 14:03:08 -0700957The projects section indicates what jobs should be run in each pipeline
James E. Blaircdd00072012-06-08 19:17:28 -0700958for events associated with each project. It contains a list of
959projects. Here is an example::
960
961 - name: example/project
962 check:
963 - project-merge:
964 - project-unittest
Clark Boylan00635dc2012-09-19 14:03:08 -0700965 - project-pep8
966 - project-pyflakes
James E. Blaircdd00072012-06-08 19:17:28 -0700967 gate:
968 - project-merge:
969 - project-unittest
Clark Boylan00635dc2012-09-19 14:03:08 -0700970 - project-pep8
971 - project-pyflakes
James E. Blaircdd00072012-06-08 19:17:28 -0700972 post:
973 - project-publish
974
975**name**
976 The name of the project (as known by Gerrit).
977
James E. Blair19deff22013-08-25 13:17:35 -0700978**merge-mode (optional)**
979 An optional value that indicates what strategy should be used to
980 merge changes to this project. Supported values are:
981
982 ** merge-resolve **
983 Equivalent to 'git merge -s resolve'. This corresponds closely to
984 what Gerrit performs (using JGit) for a project if the "Merge if
985 necessary" merge mode is selected and "Automatically resolve
986 conflicts" is checked. This is the default.
987
988 ** merge **
989 Equivalent to 'git merge'.
990
991 ** cherry-pick **
992 Equivalent to 'git cherry-pick'.
993
Clark Boylan00635dc2012-09-19 14:03:08 -0700994This is followed by a section for each of the pipelines defined above.
995Pipelines may be omitted if no jobs should run for this project in a
996given pipeline. Within the pipeline section, the jobs that should be
James E. Blaircdd00072012-06-08 19:17:28 -0700997executed are listed. If a job is entered as a dictionary key, then
998jobs contained within that key are only executed if the key job
999succeeds. In the above example, project-unittest, project-pep8, and
1000project-pyflakes are only executed if project-merge succeeds. This
1001can help avoid running unnecessary jobs.
1002
James E. Blair18c64442014-03-18 10:14:45 -07001003The special job named ``noop`` is internal to Zuul and will always
1004return ``SUCCESS`` immediately. This can be useful if you require
1005that all changes be processed by a pipeline but a project has no jobs
1006that can be run on it.
1007
Andreas Jaegerbcfbf932014-09-29 20:21:44 +02001008.. 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 -07001009
Antoine Musso80edd5a2013-02-13 15:37:53 +01001010Project Templates
1011"""""""""""""""""
1012
Michael Prokop526926a2013-10-24 16:16:57 +02001013Whenever you have lot of similar projects (such as plugins for a project) you
Antoine Musso80edd5a2013-02-13 15:37:53 +01001014will most probably want to use the same pipeline configurations. The
1015project templates let you define pipelines and job name templates to trigger.
1016One can then just apply the template on its project which make it easier to
Michael Prokop526926a2013-10-24 16:16:57 +02001017update several similar projects. As an example::
Antoine Musso80edd5a2013-02-13 15:37:53 +01001018
1019 project-templates:
1020 # Name of the template
1021 - name: plugin-triggering
1022 # Definition of pipelines just like for a `project`
1023 check:
1024 - '{jobprefix}-merge':
1025 - '{jobprefix}-pep8'
1026 - '{jobprefix}-pyflakes'
1027 gate:
1028 - '{jobprefix}-merge':
1029 - '{jobprefix}-unittest'
1030 - '{jobprefix}-pep8'
1031 - '{jobprefix}-pyflakes'
1032
1033In your projects definition, you will then apply the template using the template
1034key::
1035
1036 projects:
1037 - name: plugin/foobar
1038 template:
1039 - name: plugin-triggering
1040 jobprefix: plugin-foobar
1041
James E. Blairaea6cf62013-12-16 15:38:12 -08001042You can pass several parameters to a template. A ``parameter`` value
1043will be used for expansion of ``{parameter}`` in the template
1044strings. The parameter ``name`` will be automatically provided and
1045will contain the short name of the project, that is the portion of the
1046project name after the last ``/`` character.
James E. Blaircdd00072012-06-08 19:17:28 -07001047
James E. Blair3e98c022013-12-16 15:25:38 -08001048Multiple templates can be combined in a project, and the jobs from all
1049of those templates will be added to the project. Individual jobs may
1050also be added::
1051
1052 projects:
1053 - name: plugin/foobar
1054 template:
1055 - name: plugin-triggering
1056 jobprefix: plugin-foobar
1057 - name: plugin-extras
1058 jobprefix: plugin-foobar
1059 check:
1060 - foobar-extra-special-job
1061
Steven Dake21ef9ad2014-08-25 23:08:14 -07001062Individual jobs may optionally be added to pipelines (e.g. check,
Atsushi SAKAI5d7e93b2015-07-28 22:15:48 +09001063gate, et cetera) for a project, in addition to those provided by
Steven Dake21ef9ad2014-08-25 23:08:14 -07001064templates.
1065
James E. Blair3e98c022013-12-16 15:25:38 -08001066The order of the jobs listed in the project (which only affects the
1067order of jobs listed on the report) will be the jobs from each
1068template in the order listed, followed by any jobs individually listed
1069for the project.
1070
1071Note that if multiple templates are used for a project and one
1072template specifies a job that is also specified in another template,
James E. Blair12a92b12014-03-26 11:54:53 -07001073or specified in the project itself, the configuration defined by
1074either the last template or the project itself will take priority.
James E. Blair3e98c022013-12-16 15:25:38 -08001075
James E. Blaircdd00072012-06-08 19:17:28 -07001076logging.conf
1077~~~~~~~~~~~~
1078This file is optional. If provided, it should be a standard
1079:mod:`logging.config` module configuration file. If not present, Zuul will
1080output all log messages of DEBUG level or higher to the console.
1081
1082Starting Zuul
1083-------------
1084
1085To start Zuul, run **zuul-server**::
1086
Antoine Mussob3aa8282013-04-19 15:16:59 +02001087 usage: zuul-server [-h] [-c CONFIG] [-l LAYOUT] [-d] [-t] [--version]
James E. Blaircdd00072012-06-08 19:17:28 -07001088
1089 Project gating system.
1090
1091 optional arguments:
1092 -h, --help show this help message and exit
1093 -c CONFIG specify the config file
Antoine Mussob3aa8282013-04-19 15:16:59 +02001094 -l LAYOUT specify the layout file
James E. Blaircdd00072012-06-08 19:17:28 -07001095 -d do not run as a daemon
Antoine Mussob3aa8282013-04-19 15:16:59 +02001096 -t validate layout file syntax
1097 --version show zuul version
James E. Blaircdd00072012-06-08 19:17:28 -07001098
1099You may want to use the ``-d`` argument while you are initially setting
1100up Zuul so you can detect any configuration errors quickly. Under
1101normal operation, omit ``-d`` and let Zuul run as a daemon.
1102
1103If you send signal 1 (SIGHUP) to the zuul-server process, Zuul will
1104stop executing new jobs, wait until all executing jobs are finished,
1105reload its configuration, and resume. Any values in any of the
1106configuration files may be changed, except the location of Zuul's PID
1107file (a change to that will be ignored until Zuul is restarted).
Clark Boylanf231fa22013-02-08 12:28:53 -08001108
1109If you send a SIGUSR1 to the zuul-server process, Zuul will stop
1110executing new jobs, wait until all executing jobs are finished,
1111then exit. While waiting to exit Zuul will queue Gerrit events and
1112save these events prior to exiting. When Zuul starts again it will
1113read these saved events and act on them.
Jeremy Stanley93e05f42013-03-08 17:29:17 +00001114
Michael Prokop526926a2013-10-24 16:16:57 +02001115If you need to abort Zuul and intend to manually requeue changes for
Jeremy Stanley93e05f42013-03-08 17:29:17 +00001116jobs which were running in its pipelines, prior to terminating you can
1117use the zuul-changes.py tool script to simplify the process. For
Ramy Asselindda8e6a2015-03-31 14:59:39 -07001118example, this would give you a list of zuul-enqueue commands to requeue
1119changes for the gate and check pipelines respectively::
Jeremy Stanley93e05f42013-03-08 17:29:17 +00001120
Ramy Asselindda8e6a2015-03-31 14:59:39 -07001121 ./tools/zuul-changes.py http://zuul.openstack.org/ gate
1122 ./tools/zuul-changes.py http://zuul.openstack.org/ check
Clark Boylanfba9b242013-08-20 10:11:17 -07001123
Antoine Musso29eab012014-10-28 21:35:22 +01001124If you send a SIGUSR2 to the zuul-server process, or the forked process
1125that runs the Gearman daemon, Zuul will dump a stack trace for each
1126running thread into its debug log. It is written under the log bucket
1127``zuul.stack_dump``. This is useful for tracking down deadlock or
1128otherwise slow threads.
Antoine Mussod0f06262014-06-04 09:54:24 +02001129
1130When `yappi <https://code.google.com/p/yappi/>`_ (Yet Another Python
1131Profiler) is available, additional functions' and threads' stats are
1132emitted as well. The first SIGUSR2 will enable yappi, on the second
1133SIGUSR2 it dumps the information collected, resets all yappi state and
1134stops profiling. This is to minimize the impact of yappi on a running
1135system.