blob: 0932c5698b82bc954a276bd9dbae804d1ea198bb [file] [log] [blame]
James E. Blair1de8d402017-05-07 17:08:04 -07001:title: Project Configuration
2
3.. _project-config:
4
5Project Configuration
6=====================
7
8The following sections describe the main part of Zuul's configuration.
9All of what follows is found within files inside of the repositories
10that Zuul manages.
11
12Security Contexts
13-----------------
14
15When a system administrator configures Zuul to operate on a project,
16they specify one of two security contexts for that project. A
17*config-project* is one which is primarily tasked with holding
18configuration information and job content for Zuul. Jobs which are
James E. Blairac3c7ae2017-07-31 09:01:08 -070019defined in a config-project are run with elevated privileges, and all
James E. Blair2bab6e72017-08-07 09:52:45 -070020Zuul configuration items are available for use. Base jobs (that is,
21jobs without a parent) may only be defined in config-projects. It is
22expected that changes to config-projects will undergo careful scrutiny
23before being merged.
James E. Blair1de8d402017-05-07 17:08:04 -070024
25An *untrusted-project* is a project whose primary focus is not to
26operate Zuul, but rather it is one of the projects being tested or
27deployed. The Zuul configuration language available to these projects
James E. Blairac3c7ae2017-07-31 09:01:08 -070028is somewhat restricted (as detailed in individual sections below), and
James E. Blair1de8d402017-05-07 17:08:04 -070029jobs defined in these projects run in a restricted execution
30environment since they may be operating on changes which have not yet
31undergone review.
32
33Configuration Loading
34---------------------
35
36When Zuul starts, it examines all of the git repositories which are
James E. Blairac3c7ae2017-07-31 09:01:08 -070037specified by the system administrator in :ref:`tenant-config` and
38searches for files in the root of each repository. Zuul looks first
39for a file named ``zuul.yaml`` or a directory named ``zuul.d``, and if
40they are not found, ``.zuul.yaml`` or ``.zuul.d`` (with a leading
41dot). In the case of an :term:`untrusted-project`, the configuration
42from every branch is included, however, in the case of a
43:term:`config-project`, only the ``master`` branch is examined.
James E. Blair1de8d402017-05-07 17:08:04 -070044
45When a change is proposed to one of these files in an
James E. Blairac3c7ae2017-07-31 09:01:08 -070046untrusted-project, the configuration proposed in the change is merged
47into the running configuration so that any changes to Zuul's
James E. Blair1de8d402017-05-07 17:08:04 -070048configuration are self-testing as part of that change. If there is a
49configuration error, no jobs will be run and the error will be
50reported by any applicable pipelines. In the case of a change to a
James E. Blairac3c7ae2017-07-31 09:01:08 -070051config-project, the new configuration is parsed and examined for
James E. Blair1de8d402017-05-07 17:08:04 -070052errors, but the new configuration is not used in testing the change.
James E. Blairac3c7ae2017-07-31 09:01:08 -070053This is because configuration in config-projects is able to access
James E. Blair1de8d402017-05-07 17:08:04 -070054elevated privileges and should always be reviewed before being merged.
55
56As soon as a change containing a Zuul configuration change merges to
57any Zuul-managed repository, the new configuration takes effect
58immediately.
59
Monty Taylordb39bbb2017-08-23 17:24:00 -040060.. _configuration-items:
61
James E. Blair1de8d402017-05-07 17:08:04 -070062Configuration Items
63-------------------
64
James E. Blairac3c7ae2017-07-31 09:01:08 -070065The ``zuul.yaml`` and ``.zuul.yaml`` configuration files are
James E. Blair1de8d402017-05-07 17:08:04 -070066YAML-formatted and are structured as a series of items, each of which
67is described below.
68
James E. Blairac3c7ae2017-07-31 09:01:08 -070069In the case of a ``zuul.d`` directory, Zuul recurses the directory and
70extends the configuration using all the .yaml files in the sorted path
71order. For example, to keep job's variants in a separate file, it
72needs to be loaded after the main entries, for example using number
73prefixes in file's names::
Tristan Cacqueray4a015832017-07-11 05:18:14 +000074
75* zuul.d/pipelines.yaml
76* zuul.d/projects.yaml
77* zuul.d/01_jobs.yaml
78* zuul.d/02_jobs-variants.yaml
79
James E. Blair1de8d402017-05-07 17:08:04 -070080.. _pipeline:
81
82Pipeline
83~~~~~~~~
84
85A pipeline describes a workflow operation in Zuul. It associates jobs
86for a given project with triggering and reporting events.
87
88Its flexible configuration allows for characterizing any number of
89workflows, and by specifying each as a named configuration, makes it
90easy to apply similar workflow operations to projects or groups of
91projects.
92
93By way of example, one of the primary uses of Zuul is to perform
James E. Blairac3c7ae2017-07-31 09:01:08 -070094project gating. To do so, one can create a :term:`gate` pipeline
95which tells Zuul that when a certain event (such as approval by a code
James E. Blair1de8d402017-05-07 17:08:04 -070096reviewer) occurs, the corresponding change or pull request should be
97enqueued into the pipeline. When that happens, the jobs which have
James E. Blairac3c7ae2017-07-31 09:01:08 -070098been configured to run for that project in the gate pipeline are run,
99and when they complete, the pipeline reports the results to the user.
James E. Blair1de8d402017-05-07 17:08:04 -0700100
James E. Blairac3c7ae2017-07-31 09:01:08 -0700101Pipeline configuration items may only appear in :term:`config-projects
102<config-project>`.
James E. Blair1de8d402017-05-07 17:08:04 -0700103
104Generally, a Zuul administrator would define a small number of
105pipelines which represent the workflow processes used in their
106environment. Each project can then be added to the available
107pipelines as appropriate.
108
James E. Blairac3c7ae2017-07-31 09:01:08 -0700109Here is an example :term:`check` pipeline, which runs whenever a new
James E. Blair1de8d402017-05-07 17:08:04 -0700110patchset is created in Gerrit. If the associated jobs all report
James E. Blairac3c7ae2017-07-31 09:01:08 -0700111success, the pipeline reports back to Gerrit with ``Verified`` vote of
James E. Blair32c52482017-07-29 07:49:03 -0700112+1, or if at least one of them fails, a -1:
James E. Blair1de8d402017-05-07 17:08:04 -0700113
James E. Blair32c52482017-07-29 07:49:03 -0700114.. code-block:: yaml
115
116 - pipeline:
117 name: check
118 manager: independent
119 trigger:
120 my_gerrit:
121 - event: patchset-created
122 success:
123 my_gerrit:
124 Verified: 1
125 failure:
126 my_gerrit
127 Verified: -1
James E. Blair1de8d402017-05-07 17:08:04 -0700128
James E. Blaireff5a9d2017-06-20 00:00:37 -0700129.. TODO: See TODO for more annotated examples of common pipeline configurations.
James E. Blair1de8d402017-05-07 17:08:04 -0700130
James E. Blair94375912017-07-28 17:20:27 -0700131.. attr:: pipeline
James E. Blair7145c582017-07-26 13:30:39 -0700132
James E. Blair9fd98ab2017-07-26 14:15:26 -0700133 The attributes available on a pipeline are as follows (all are
134 optional unless otherwise specified):
James E. Blair1de8d402017-05-07 17:08:04 -0700135
James E. Blair94375912017-07-28 17:20:27 -0700136 .. attr:: name
James E. Blair9fd98ab2017-07-26 14:15:26 -0700137 :required:
James E. Blair1de8d402017-05-07 17:08:04 -0700138
James E. Blair9fd98ab2017-07-26 14:15:26 -0700139 This is used later in the project definition to indicate what jobs
140 should be run for events in the pipeline.
James E. Blair1de8d402017-05-07 17:08:04 -0700141
James E. Blair94375912017-07-28 17:20:27 -0700142 .. attr:: manager
James E. Blair9fd98ab2017-07-26 14:15:26 -0700143 :required:
James E. Blaireff5a9d2017-06-20 00:00:37 -0700144
James E. Blair9fd98ab2017-07-26 14:15:26 -0700145 There are currently two schemes for managing pipelines:
James E. Blair1de8d402017-05-07 17:08:04 -0700146
James E. Blair32c52482017-07-29 07:49:03 -0700147 .. value:: independent
James E. Blaireff5a9d2017-06-20 00:00:37 -0700148
James E. Blair9fd98ab2017-07-26 14:15:26 -0700149 Every event in this pipeline should be treated as independent
150 of other events in the pipeline. This is appropriate when
151 the order of events in the pipeline doesn't matter because
152 the results of the actions this pipeline performs can not
153 affect other events in the pipeline. For example, when a
154 change is first uploaded for review, you may want to run
155 tests on that change to provide early feedback to reviewers.
156 At the end of the tests, the change is not going to be
157 merged, so it is safe to run these tests in parallel without
158 regard to any other changes in the pipeline. They are
159 independent.
James E. Blair1de8d402017-05-07 17:08:04 -0700160
James E. Blair9fd98ab2017-07-26 14:15:26 -0700161 Another type of pipeline that is independent is a post-merge
162 pipeline. In that case, the changes have already merged, so
163 the results can not affect any other events in the pipeline.
James E. Blair1761e862017-07-25 16:15:47 -0700164
James E. Blair32c52482017-07-29 07:49:03 -0700165 .. value:: dependent
James E. Blair1761e862017-07-25 16:15:47 -0700166
James E. Blair9fd98ab2017-07-26 14:15:26 -0700167 The dependent pipeline manager is designed for gating. It
168 ensures that every change is tested exactly as it is going to
169 be merged into the repository. An ideal gating system would
170 test one change at a time, applied to the tip of the
171 repository, and only if that change passed tests would it be
172 merged. Then the next change in line would be tested the
173 same way. In order to achieve parallel testing of changes,
174 the dependent pipeline manager performs speculative execution
175 on changes. It orders changes based on their entry into the
176 pipeline. It begins testing all changes in parallel,
177 assuming that each change ahead in the pipeline will pass its
178 tests. If they all succeed, all the changes can be tested
179 and merged in parallel. If a change near the front of the
180 pipeline fails its tests, each change behind it ignores
181 whatever tests have been completed and are tested again
182 without the change in front. This way gate tests may run in
183 parallel but still be tested correctly, exactly as they will
184 appear in the repository when merged.
James E. Blair1761e862017-07-25 16:15:47 -0700185
James E. Blair9fd98ab2017-07-26 14:15:26 -0700186 For more detail on the theory and operation of Zuul's
187 dependent pipeline manager, see: :doc:`gating`.
James E. Blair1de8d402017-05-07 17:08:04 -0700188
James E. Blair8eb564a2017-08-10 09:21:41 -0700189 .. attr:: post-review
James E. Blair88d84242017-07-31 12:05:16 -0700190 :default: false
James E. Blairf17aa9c2017-07-05 13:21:23 -0700191
James E. Blair8eb564a2017-08-10 09:21:41 -0700192 This is a boolean which indicates that this pipeline executes
193 code that has been reviewed. Some jobs perform actions which
194 should not be permitted with unreviewed code. When this value
195 is ``false`` those jobs will not be permitted to run in the
196 pipeline. If a pipeline is designed only to be used after
197 changes are reviewed or merged, set this value to ``true`` to
198 permit such jobs.
James E. Blairf17aa9c2017-07-05 13:21:23 -0700199
James E. Blair8eb564a2017-08-10 09:21:41 -0700200 For more information, see :ref:`secret` and
201 :attr:`job.post-review`.
James E. Blair1de8d402017-05-07 17:08:04 -0700202
James E. Blair94375912017-07-28 17:20:27 -0700203 .. attr:: description
James E. Blair1de8d402017-05-07 17:08:04 -0700204
James E. Blair9fd98ab2017-07-26 14:15:26 -0700205 This field may be used to provide a textual description of the
206 pipeline. It may appear in the status page or in documentation.
James E. Blair1de8d402017-05-07 17:08:04 -0700207
James E. Blair94375912017-07-28 17:20:27 -0700208 .. attr:: success-message
James E. Blair88d84242017-07-31 12:05:16 -0700209 :default: Build successful.
James E. Blair1de8d402017-05-07 17:08:04 -0700210
James E. Blair9fd98ab2017-07-26 14:15:26 -0700211 The introductory text in reports when all the voting jobs are
James E. Blair88d84242017-07-31 12:05:16 -0700212 successful.
James E. Blair1de8d402017-05-07 17:08:04 -0700213
James E. Blair94375912017-07-28 17:20:27 -0700214 .. attr:: failure-message
James E. Blair88d84242017-07-31 12:05:16 -0700215 :default: Build failed.
James E. Blair1de8d402017-05-07 17:08:04 -0700216
James E. Blair9fd98ab2017-07-26 14:15:26 -0700217 The introductory text in reports when at least one voting job
James E. Blair88d84242017-07-31 12:05:16 -0700218 fails.
James E. Blair1de8d402017-05-07 17:08:04 -0700219
James E. Blair94375912017-07-28 17:20:27 -0700220 .. attr:: merge-failure-message
James E. Blair88d84242017-07-31 12:05:16 -0700221 :default: Merge failed.
James E. Blair1de8d402017-05-07 17:08:04 -0700222
James E. Blair9fd98ab2017-07-26 14:15:26 -0700223 The introductory text in the message reported when a change
224 fails to merge with the current state of the repository.
225 Defaults to "Merge failed."
James E. Blair1de8d402017-05-07 17:08:04 -0700226
James E. Blair94375912017-07-28 17:20:27 -0700227 .. attr:: footer-message
James E. Blair1de8d402017-05-07 17:08:04 -0700228
James E. Blair9fd98ab2017-07-26 14:15:26 -0700229 Supplies additional information after test results. Useful for
230 adding information about the CI system such as debugging and
231 contact details.
James E. Blair1de8d402017-05-07 17:08:04 -0700232
James E. Blair94375912017-07-28 17:20:27 -0700233 .. attr:: trigger
James E. Blair1de8d402017-05-07 17:08:04 -0700234
James E. Blair9fd98ab2017-07-26 14:15:26 -0700235 At least one trigger source must be supplied for each pipeline.
236 Triggers are not exclusive -- matching events may be placed in
237 multiple pipelines, and they will behave independently in each
238 of the pipelines they match.
James E. Blair1de8d402017-05-07 17:08:04 -0700239
James E. Blair9fd98ab2017-07-26 14:15:26 -0700240 Triggers are loaded from their connection name. The driver type
241 of the connection will dictate which options are available. See
242 :ref:`drivers`.
James E. Blair1de8d402017-05-07 17:08:04 -0700243
James E. Blair94375912017-07-28 17:20:27 -0700244 .. attr:: require
James E. Blair1de8d402017-05-07 17:08:04 -0700245
James E. Blairac3c7ae2017-07-31 09:01:08 -0700246 If this section is present, it establishes prerequisites for
James E. Blair9fd98ab2017-07-26 14:15:26 -0700247 any kind of item entering the Pipeline. Regardless of how the
248 item is to be enqueued (via any trigger or automatic dependency
249 resolution), the conditions specified here must be met or the
James E. Blaird134c6d2017-07-26 16:09:34 -0700250 item will not be enqueued. These requirements may vary
251 depending on the source of the item being enqueued.
James E. Blair1de8d402017-05-07 17:08:04 -0700252
James E. Blaird134c6d2017-07-26 16:09:34 -0700253 Requirements are loaded from their connection name. The driver
254 type of the connection will dictate which options are available.
255 See :ref:`drivers`.
James E. Blair1de8d402017-05-07 17:08:04 -0700256
James E. Blair94375912017-07-28 17:20:27 -0700257 .. attr:: reject
James E. Blair1de8d402017-05-07 17:08:04 -0700258
James E. Blairac3c7ae2017-07-31 09:01:08 -0700259 If this section is present, it establishes prerequisites that
James E. Blair9fd98ab2017-07-26 14:15:26 -0700260 can block an item from being enqueued. It can be considered a
James E. Blairac3c7ae2017-07-31 09:01:08 -0700261 negative version of :attr:`pipeline.require`.
James E. Blair1de8d402017-05-07 17:08:04 -0700262
James E. Blaird134c6d2017-07-26 16:09:34 -0700263 Requirements are loaded from their connection name. The driver
264 type of the connection will dictate which options are available.
265 See :ref:`drivers`.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700266
James E. Blair94375912017-07-28 17:20:27 -0700267 .. attr:: dequeue-on-new-patchset
James E. Blair88d84242017-07-31 12:05:16 -0700268 :default: true
James E. Blair9fd98ab2017-07-26 14:15:26 -0700269
270 Normally, if a new patchset is uploaded to a change that is in a
271 pipeline, the existing entry in the pipeline will be removed
272 (with jobs canceled and any dependent changes that can no longer
273 merge as well. To suppress this behavior (and allow jobs to
James E. Blair88d84242017-07-31 12:05:16 -0700274 continue running), set this to ``false``.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700275
James E. Blair94375912017-07-28 17:20:27 -0700276 .. attr:: ignore-dependencies
James E. Blair88d84242017-07-31 12:05:16 -0700277 :default: false
James E. Blair9fd98ab2017-07-26 14:15:26 -0700278
279 In any kind of pipeline (dependent or independent), Zuul will
280 attempt to enqueue all dependencies ahead of the current change
281 so that they are tested together (independent pipelines report
282 the results of each change regardless of the results of changes
283 ahead). To ignore dependencies completely in an independent
284 pipeline, set this to ``true``. This option is ignored by
James E. Blair88d84242017-07-31 12:05:16 -0700285 dependent pipelines.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700286
James E. Blair94375912017-07-28 17:20:27 -0700287 .. attr:: precedence
James E. Blair88d84242017-07-31 12:05:16 -0700288 :default: normal
James E. Blair9fd98ab2017-07-26 14:15:26 -0700289
290 Indicates how the build scheduler should prioritize jobs for
291 different pipelines. Each pipeline may have one precedence,
292 jobs for pipelines with a higher precedence will be run before
293 ones with lower. The value should be one of ``high``,
294 ``normal``, or ``low``. Default: ``normal``.
295
James E. Blairac3c7ae2017-07-31 09:01:08 -0700296 .. _reporters:
297
298 The following options configure :term:`reporters <reporter>`.
299 Reporters are complementary to triggers; where a trigger is an
300 event on a connection which causes Zuul to enqueue an item, a
301 reporter is the action performed on a connection when an item is
302 dequeued after its jobs complete. The actual syntax for a reporter
303 is defined by the driver which implements it. See :ref:`drivers`
304 for more information.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700305
James E. Blair94375912017-07-28 17:20:27 -0700306 .. attr:: success
James E. Blair9fd98ab2017-07-26 14:15:26 -0700307
308 Describes where Zuul should report to if all the jobs complete
309 successfully. This section is optional; if it is omitted, Zuul
310 will run jobs and do nothing on success -- it will not report at
James E. Blairac3c7ae2017-07-31 09:01:08 -0700311 all. If the section is present, the listed :term:`reporters
312 <reporter>` will be asked to report on the jobs. The reporters
313 are listed by their connection name. The options available
314 depend on the driver for the supplied connection.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700315
James E. Blair94375912017-07-28 17:20:27 -0700316 .. attr:: failure
James E. Blair9fd98ab2017-07-26 14:15:26 -0700317
318 These reporters describe what Zuul should do if at least one job
319 fails.
320
James E. Blair94375912017-07-28 17:20:27 -0700321 .. attr:: merge-failure
James E. Blair9fd98ab2017-07-26 14:15:26 -0700322
323 These reporters describe what Zuul should do if it is unable to
324 merge in the patchset. If no merge-failure reporters are listed
325 then the ``failure`` reporters will be used to notify of
326 unsuccessful merges.
327
James E. Blair94375912017-07-28 17:20:27 -0700328 .. attr:: start
James E. Blair9fd98ab2017-07-26 14:15:26 -0700329
330 These reporters describe what Zuul should do when a change is
331 added to the pipeline. This can be used, for example, to reset
332 a previously reported result.
333
James E. Blair94375912017-07-28 17:20:27 -0700334 .. attr:: disabled
James E. Blair9fd98ab2017-07-26 14:15:26 -0700335
336 These reporters describe what Zuul should do when a pipeline is
337 disabled. See ``disable-after-consecutive-failures``.
338
339 The following options can be used to alter Zuul's behavior to
340 mitigate situations in which jobs are failing frequently (perhaps
341 due to a problem with an external dependency, or unusually high
342 non-deterministic test failures).
343
James E. Blair94375912017-07-28 17:20:27 -0700344 .. attr:: disable-after-consecutive-failures
James E. Blair9fd98ab2017-07-26 14:15:26 -0700345
James E. Blairac3c7ae2017-07-31 09:01:08 -0700346 If set, a pipeline can enter a *disabled* state if too many
James E. Blair9fd98ab2017-07-26 14:15:26 -0700347 changes in a row fail. When this value is exceeded the pipeline
James E. Blairac3c7ae2017-07-31 09:01:08 -0700348 will stop reporting to any of the **success**, **failure** or
349 **merge-failure** reporters and instead only report to the
350 **disabled** reporters. (No **start** reports are made when a
James E. Blair9fd98ab2017-07-26 14:15:26 -0700351 pipeline is disabled).
352
James E. Blair94375912017-07-28 17:20:27 -0700353 .. attr:: window
James E. Blair88d84242017-07-31 12:05:16 -0700354 :default: 20
James E. Blair9fd98ab2017-07-26 14:15:26 -0700355
356 Dependent pipeline managers only. Zuul can rate limit dependent
357 pipelines in a manner similar to TCP flow control. Jobs are
358 only started for items in the queue if they are within the
359 actionable window for the pipeline. The initial length of this
360 window is configurable with this value. The value given should
361 be a positive integer value. A value of ``0`` disables rate
James E. Blairac3c7ae2017-07-31 09:01:08 -0700362 limiting on the :value:`dependent pipeline manager
James E. Blair88d84242017-07-31 12:05:16 -0700363 <pipeline.manager.dependent>`.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700364
James E. Blair94375912017-07-28 17:20:27 -0700365 .. attr:: window-floor
James E. Blair88d84242017-07-31 12:05:16 -0700366 :default: 3
James E. Blair9fd98ab2017-07-26 14:15:26 -0700367
368 Dependent pipeline managers only. This is the minimum value for
369 the window described above. Should be a positive non zero
James E. Blair88d84242017-07-31 12:05:16 -0700370 integer value.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700371
James E. Blair94375912017-07-28 17:20:27 -0700372 .. attr:: window-increase-type
James E. Blair88d84242017-07-31 12:05:16 -0700373 :default: linear
James E. Blair9fd98ab2017-07-26 14:15:26 -0700374
375 Dependent pipeline managers only. This value describes how the
James E. Blairac3c7ae2017-07-31 09:01:08 -0700376 window should grow when changes are successfully merged by zuul.
377
378 .. value:: linear
379
380 Indicates that **window-increase-factor** should be added to
James E. Blair88d84242017-07-31 12:05:16 -0700381 the previous window value.
James E. Blairac3c7ae2017-07-31 09:01:08 -0700382
383 .. value:: exponential
384
385 Indicates that **window-increase-factor** should be
386 multiplied against the previous window value and the result
387 will become the window size.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700388
James E. Blair94375912017-07-28 17:20:27 -0700389 .. attr:: window-increase-factor
James E. Blair88d84242017-07-31 12:05:16 -0700390 :default: 1
James E. Blair9fd98ab2017-07-26 14:15:26 -0700391
392 Dependent pipeline managers only. The value to be added or
393 multiplied against the previous window value to determine the
James E. Blair88d84242017-07-31 12:05:16 -0700394 new window after successful change merges.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700395
James E. Blair94375912017-07-28 17:20:27 -0700396 .. attr:: window-decrease-type
James E. Blair88d84242017-07-31 12:05:16 -0700397 :default: exponential
James E. Blair9fd98ab2017-07-26 14:15:26 -0700398
399 Dependent pipeline managers only. This value describes how the
400 window should shrink when changes are not able to be merged by
James E. Blairac3c7ae2017-07-31 09:01:08 -0700401 Zuul.
402
403 .. value:: linear
404
405 Indicates that **window-decrease-factor** should be
406 subtracted from the previous window value.
407
408 .. value:: exponential
409
410 Indicates that **window-decrease-factor** should be divided
411 against the previous window value and the result will become
James E. Blair88d84242017-07-31 12:05:16 -0700412 the window size.
James E. Blair9fd98ab2017-07-26 14:15:26 -0700413
James E. Blair94375912017-07-28 17:20:27 -0700414 .. attr:: window-decrease-factor
James E. Blair88d84242017-07-31 12:05:16 -0700415 :default: 2
James E. Blair9fd98ab2017-07-26 14:15:26 -0700416
James E. Blairac3c7ae2017-07-31 09:01:08 -0700417 :value:`Dependent pipeline managers
418 <pipeline.manager.dependent>` only. The value to be subtracted
419 or divided against the previous window value to determine the
James E. Blair88d84242017-07-31 12:05:16 -0700420 new window after unsuccessful change merges.
James E. Blair1de8d402017-05-07 17:08:04 -0700421
422
423.. _job:
424
425Job
426~~~
427
428A job is a unit of work performed by Zuul on an item enqueued into a
429pipeline. Items may run any number of jobs (which may depend on each
430other). Each job is an invocation of an Ansible playbook with a
431specific inventory of hosts. The actual tasks that are run by the job
432appear in the playbook for that job while the attributes that appear in the
433Zuul configuration specify information about when, where, and how the
434job should be run.
435
436Jobs in Zuul support inheritance. Any job may specify a single parent
437job, and any attributes not set on the child job are collected from
438the parent job. In this way, a configuration structure may be built
439starting with very basic jobs which describe characteristics that all
440jobs on the system should have, progressing through stages of
441specialization before arriving at a particular job. A job may inherit
442from any other job in any project (however, if the other job is marked
Tobias Henkel83167622017-06-30 19:45:03 +0200443as :attr:`job.final`, jobs may not inherit from it).
James E. Blair1de8d402017-05-07 17:08:04 -0700444
James E. Blair2bab6e72017-08-07 09:52:45 -0700445A job with no parent is called a *base job* and may only be defined in
446a :term:`config-project`. Every other job must have a parent, and so
447ultimately, all jobs must have an inheritance path which terminates at
448a base job. Each tenant has a default parent job which will be used
449if no explicit parent is specified.
450
James E. Blairc32a8352017-10-11 16:27:50 -0700451Multiple job definitions with the same name are called variants.
James E. Blair1de8d402017-05-07 17:08:04 -0700452These may have different selection criteria which indicate to Zuul
453that, for instance, the job should behave differently on a different
454git branch. Unlike inheritance, all job variants must be defined in
Tobias Henkel83167622017-06-30 19:45:03 +0200455the same project. Some attributes of jobs marked :attr:`job.final`
456may not be overidden
James E. Blair1de8d402017-05-07 17:08:04 -0700457
458When Zuul decides to run a job, it performs a process known as
459freezing the job. Because any number of job variants may be
460applicable, Zuul collects all of the matching variants and applies
461them in the order they appeared in the configuration. The resulting
462frozen job is built from attributes gathered from all of the
463matching variants. In this way, exactly what is run is dependent on
464the pipeline, project, branch, and content of the item.
465
466In addition to the job's main playbook, each job may specify one or
467more pre- and post-playbooks. These are run, in order, before and
468after (respectively) the main playbook. They may be used to set up
469and tear down resources needed by the main playbook. When combined
470with inheritance, they provide powerful tools for job construction. A
471job only has a single main playbook, and when inheriting from a
472parent, the child's main playbook overrides (or replaces) the
473parent's. However, the pre- and post-playbooks are appended and
474prepended in a nesting fashion. So if a parent job and child job both
475specified pre and post playbooks, the sequence of playbooks run would
476be:
477
478* parent pre-run playbook
479* child pre-run playbook
480* child playbook
481* child post-run playbook
482* parent post-run playbook
483
484Further inheritance would nest even deeper.
485
James E. Blair32c52482017-07-29 07:49:03 -0700486Here is an example of two job definitions:
James E. Blair1de8d402017-05-07 17:08:04 -0700487
James E. Blair32c52482017-07-29 07:49:03 -0700488.. code-block:: yaml
James E. Blair1de8d402017-05-07 17:08:04 -0700489
James E. Blair32c52482017-07-29 07:49:03 -0700490 - job:
491 name: base
492 pre-run: copy-git-repos
493 post-run: copy-logs
James E. Blair1de8d402017-05-07 17:08:04 -0700494
James E. Blair32c52482017-07-29 07:49:03 -0700495 - job:
496 name: run-tests
497 parent: base
James E. Blair7e3e6882017-09-20 15:47:13 -0700498 nodeset:
499 nodes:
500 - name: test-node
501 label: fedora
James E. Blair1de8d402017-05-07 17:08:04 -0700502
James E. Blair32c52482017-07-29 07:49:03 -0700503.. attr:: job
James E. Blair1de8d402017-05-07 17:08:04 -0700504
James E. Blair32c52482017-07-29 07:49:03 -0700505 The following attributes are available on a job; all are optional
506 unless otherwise specified:
James E. Blair1de8d402017-05-07 17:08:04 -0700507
James E. Blair32c52482017-07-29 07:49:03 -0700508 .. attr:: name
509 :required:
James E. Blair1de8d402017-05-07 17:08:04 -0700510
James E. Blair32c52482017-07-29 07:49:03 -0700511 The name of the job. By default, Zuul looks for a playbook with
512 this name to use as the main playbook for the job. This name is
513 also referenced later in a project pipeline configuration.
James E. Blair1de8d402017-05-07 17:08:04 -0700514
James E. Blair2bab6e72017-08-07 09:52:45 -0700515 .. TODO: figure out how to link the parent default to tenant.default.parent
516
James E. Blair32c52482017-07-29 07:49:03 -0700517 .. attr:: parent
James E. Blair2bab6e72017-08-07 09:52:45 -0700518 :default: Tenant default-parent
James E. Blair1de8d402017-05-07 17:08:04 -0700519
James E. Blairac3c7ae2017-07-31 09:01:08 -0700520 Specifies a job to inherit from. The parent job can be defined
James E. Blair2bab6e72017-08-07 09:52:45 -0700521 in this or any other project. Any attributes not specified on a
522 job will be collected from its parent. If no value is supplied
523 here, the job specified by :attr:`tenant.default-parent` will be
524 used. If **parent** is set to ``null`` (which is only valid in
525 a :term:`config-project`), this is a :term:`base job`.
James E. Blair1de8d402017-05-07 17:08:04 -0700526
James E. Blair32c52482017-07-29 07:49:03 -0700527 .. attr:: description
James E. Blair1de8d402017-05-07 17:08:04 -0700528
James E. Blair32c52482017-07-29 07:49:03 -0700529 A textual description of the job. Not currently used directly
530 by Zuul, but it is used by the zuul-sphinx extension to Sphinx
531 to auto-document Zuul jobs (in which case it is interpreted as
532 ReStructuredText.
James E. Blair1de8d402017-05-07 17:08:04 -0700533
Tobias Henkel83167622017-06-30 19:45:03 +0200534 .. attr:: final
535 :default: false
536
537 To prevent other jobs from inheriting from this job, and also to
538 prevent changing execution-related attributes when this job is
539 specified in a project's pipeline, set this attribute to
540 ``true``.
541
Tobias Henkel130b0002017-11-26 20:27:59 +0100542 .. attr:: protected
543 :default: false
544
545 When set to ``true`` only jobs defined in the same project may inherit
546 from this job. Once this is set to ``true`` it cannot be reset to
547 ``false``.
548
James E. Blair979bf242017-09-15 21:13:32 -0600549 .. attr:: abstract
550 :default: false
551
552 To indicate a job is not intended to be run directly, but
553 instead must be inherited from, set this attribute to ``true``.
554
James E. Blair32c52482017-07-29 07:49:03 -0700555 .. attr:: success-message
James E. Blair88d84242017-07-31 12:05:16 -0700556 :default: SUCCESS
James E. Blair1de8d402017-05-07 17:08:04 -0700557
James E. Blairac3c7ae2017-07-31 09:01:08 -0700558 Normally when a job succeeds, the string ``SUCCESS`` is reported
James E. Blair32c52482017-07-29 07:49:03 -0700559 as the result for the job. If set, this option may be used to
James E. Blair88d84242017-07-31 12:05:16 -0700560 supply a different string.
James E. Blair1de8d402017-05-07 17:08:04 -0700561
James E. Blair32c52482017-07-29 07:49:03 -0700562 .. attr:: failure-message
James E. Blair88d84242017-07-31 12:05:16 -0700563 :default: FAILURE
James E. Blair1de8d402017-05-07 17:08:04 -0700564
James E. Blairac3c7ae2017-07-31 09:01:08 -0700565 Normally when a job fails, the string ``FAILURE`` is reported as
James E. Blair32c52482017-07-29 07:49:03 -0700566 the result for the job. If set, this option may be used to
James E. Blair88d84242017-07-31 12:05:16 -0700567 supply a different string.
James E. Blair1de8d402017-05-07 17:08:04 -0700568
James E. Blair32c52482017-07-29 07:49:03 -0700569 .. attr:: success-url
James E. Blair1de8d402017-05-07 17:08:04 -0700570
James E. Blair32c52482017-07-29 07:49:03 -0700571 When a job succeeds, this URL is reported along with the result.
572 If this value is not supplied, Zuul uses the content of the job
573 :ref:`return value <return_values>` **zuul.log_url**. This is
574 recommended as it allows the code which stores the URL to the
575 job artifacts to report exactly where they were stored. To
576 override this value, or if it is not set, supply an absolute URL
577 in this field. If a relative URL is supplied in this field, and
578 **zuul.log_url** is set, then the two will be combined to
579 produce the URL used for the report. This can be used to
580 specify that certain jobs should "deep link" into the stored job
James E. Blair88d84242017-07-31 12:05:16 -0700581 artifacts.
James E. Blair1de8d402017-05-07 17:08:04 -0700582
James E. Blair32c52482017-07-29 07:49:03 -0700583 .. attr:: failure-url
James E. Blair1de8d402017-05-07 17:08:04 -0700584
James E. Blair32c52482017-07-29 07:49:03 -0700585 When a job fails, this URL is reported along with the result.
586 Otherwise behaves the same as **success-url**.
James E. Blair1de8d402017-05-07 17:08:04 -0700587
James E. Blair32c52482017-07-29 07:49:03 -0700588 .. attr:: hold-following-changes
James E. Blair88d84242017-07-31 12:05:16 -0700589 :default: false
James E. Blair1de8d402017-05-07 17:08:04 -0700590
James E. Blair32c52482017-07-29 07:49:03 -0700591 In a dependent pipeline, this option may be used to indicate
592 that no jobs should start on any items which depend on the
593 current item until this job has completed successfully. This
594 may be used to conserve build resources, at the expense of
595 inhibiting the parallelization which speeds the processing of
James E. Blair88d84242017-07-31 12:05:16 -0700596 items in a dependent pipeline.
James E. Blair1de8d402017-05-07 17:08:04 -0700597
James E. Blair32c52482017-07-29 07:49:03 -0700598 .. attr:: voting
James E. Blair88d84242017-07-31 12:05:16 -0700599 :default: true
James E. Blair1de8d402017-05-07 17:08:04 -0700600
James E. Blair32c52482017-07-29 07:49:03 -0700601 Indicates whether the result of this job should be used in
James E. Blair88d84242017-07-31 12:05:16 -0700602 determining the overall result of the item.
James E. Blair1de8d402017-05-07 17:08:04 -0700603
James E. Blair32c52482017-07-29 07:49:03 -0700604 .. attr:: semaphore
James E. Blair1de8d402017-05-07 17:08:04 -0700605
James E. Blair32c52482017-07-29 07:49:03 -0700606 The name of a :ref:`semaphore` which should be acquired and
607 released when the job begins and ends. If the semaphore is at
608 maximum capacity, then Zuul will wait until it can be acquired
James E. Blair88d84242017-07-31 12:05:16 -0700609 before starting the job.
James E. Blair1de8d402017-05-07 17:08:04 -0700610
James E. Blair32c52482017-07-29 07:49:03 -0700611 .. attr:: tags
James E. Blair1de8d402017-05-07 17:08:04 -0700612
James E. Blair32c52482017-07-29 07:49:03 -0700613 Metadata about this job. Tags are units of information attached
614 to the job; they do not affect Zuul's behavior, but they can be
615 used within the job to characterize the job. For example, a job
616 which tests a certain subsystem could be tagged with the name of
617 that subsystem, and if the job's results are reported into a
618 database, then the results of all jobs affecting that subsystem
619 could be queried. This attribute is specified as a list of
620 strings, and when inheriting jobs or applying variants, tags
621 accumulate in a set, so the result is always a set of all the
622 tags from all the jobs and variants used in constructing the
James E. Blair88d84242017-07-31 12:05:16 -0700623 frozen job, with no duplication.
James E. Blair1de8d402017-05-07 17:08:04 -0700624
James E. Blaire19e88a2017-08-09 15:14:29 -0700625 .. attr:: secrets
James E. Blair1de8d402017-05-07 17:08:04 -0700626
James E. Blaire19e88a2017-08-09 15:14:29 -0700627 A list of secrets which may be used by the job. A
628 :ref:`secret` is a named collection of private information
629 defined separately in the configuration. The secrets that
630 appear here must be defined in the same project as this job
631 definition.
James E. Blair1de8d402017-05-07 17:08:04 -0700632
Monty Tayloraff8b402017-08-16 18:40:41 -0500633 Each item in the list may may be supplied either as a string,
634 in which case it references the name of a :ref:`secret` definition,
635 or as a dict. If an element in this list is given as a dict, it
636 must have the following fields.
637
638 .. attr:: name
639
640 The name to use for the Ansible variable into which the secret
641 content will be placed.
642
643 .. attr:: secret
644
645 The name to use to find the secret's definition in the configuration.
646
647 For example:
648
649 .. code-block:: yaml
650
651 - secret:
652 important-secret:
653 key: encrypted-secret-key-data
654
655 - job:
656 name: amazing-job:
657 secrets:
658 - name: ssh_key
659 secret: important-secret
660
661 will result in the following being passed as a variable to the playbooks
662 in ``amazing-job``:
663
664 .. code-block:: yaml
665
666 ssh_key:
667 key: descrypted-secret-key-data
668
James E. Blair7e3e6882017-09-20 15:47:13 -0700669 .. attr:: nodeset
James E. Blair1de8d402017-05-07 17:08:04 -0700670
James E. Blair7e3e6882017-09-20 15:47:13 -0700671 The nodes which should be supplied to the job. This parameter
672 may be supplied either as a string, in which case it references
673 a :ref:`nodeset` definition which appears elsewhere in the
674 configuration, or a dictionary, in which case it is interpreted
675 in the same way as a Nodeset definition, though the ``name``
676 attribute should be omitted (in essence, it is an anonymous
677 Nodeset definition unique to this job). See the :ref:`nodeset`
678 reference for the syntax to use in that case.
James E. Blair1de8d402017-05-07 17:08:04 -0700679
James E. Blair7e3e6882017-09-20 15:47:13 -0700680 If a job has an empty or no nodeset definition, it will still
681 run and may be able to perform actions on the Zuul executor.
James E. Blair1de8d402017-05-07 17:08:04 -0700682
James E. Blairedff2c22017-10-30 14:04:48 -0700683 .. attr:: override-checkout
James E. Blair1de8d402017-05-07 17:08:04 -0700684
James E. Blair32c52482017-07-29 07:49:03 -0700685 When Zuul runs jobs for a proposed change, it normally checks
686 out the branch associated with that change on every project
687 present in the job. If jobs are running on a ref (such as a
688 branch tip or tag), then that ref is normally checked out. This
689 attribute is used to override that behavior and indicate that
690 this job should, regardless of the branch for the queue item,
James E. Blairedff2c22017-10-30 14:04:48 -0700691 use the indicated ref (i.e., branch or tag) instead. This can
692 be used, for example, to run a previous version of the software
693 (from a stable maintenance branch) under test even if the change
694 being tested applies to a different branch (this is only likely
695 to be useful if there is some cross-branch interaction with some
James E. Blair32c52482017-07-29 07:49:03 -0700696 component of the system being tested). See also the
James E. Blairedff2c22017-10-30 14:04:48 -0700697 project-specific :attr:`job.required-projects.override-checkout`
James E. Blairac3c7ae2017-07-31 09:01:08 -0700698 attribute to apply this behavior to a subset of a job's
699 projects.
James E. Blair1de8d402017-05-07 17:08:04 -0700700
James E. Blair7fb04512018-01-23 13:23:13 -0800701 This value is also used to help select which variants of a job
702 to run. If ``override-checkout`` is set, then Zuul will use
703 this value instead of the branch of the item being tested when
704 collecting jobs to run.
705
James E. Blair32c52482017-07-29 07:49:03 -0700706 .. attr:: timeout
James E. Blair1de8d402017-05-07 17:08:04 -0700707
James E. Blairb0c8e7e2017-08-28 09:19:49 -0700708 The time in seconds that the job should be allowed to run before
James E. Blair32c52482017-07-29 07:49:03 -0700709 it is automatically aborted and failure is reported. If no
710 timeout is supplied, the job may run indefinitely. Supplying a
711 timeout is highly recommended.
712
Clark Boylanb2c22b32018-02-16 11:00:50 -0800713 This timeout only applies to the pre-run and run playbooks in a
714 job.
715
716 .. attr:: post-timeout
717
718 The time in seconds that each post playbook should be allowed to run
719 before it is automatically aborted and failure is reported. If no
720 post-timeout is supplied, the job may run indefinitely. Supplying a
721 post-timeout is highly recommended.
722
723 The post-timeout is handled separately from the above timeout because
724 the post playbooks are typically where you will copy jobs logs.
725 In the event of the pre-run or run playbooks timing out we want to
726 do our best to copy the job logs in the post-run playbooks.
727
James E. Blair32c52482017-07-29 07:49:03 -0700728 .. attr:: attempts
James E. Blair88d84242017-07-31 12:05:16 -0700729 :default: 3
James E. Blair32c52482017-07-29 07:49:03 -0700730
731 When Zuul encounters an error running a job's pre-run playbook,
732 Zuul will stop and restart the job. Errors during the main or
733 post-run -playbook phase of a job are not affected by this
734 parameter (they are reported immediately). This parameter
735 controls the number of attempts to make before an error is
James E. Blair88d84242017-07-31 12:05:16 -0700736 reported.
James E. Blair32c52482017-07-29 07:49:03 -0700737
738 .. attr:: pre-run
739
James E. Blair68286562017-10-26 10:55:16 -0700740 The name of a playbook or list of playbooks to run before the
741 main body of a job. The full path to the playbook in the repo
742 where the job is defined is expected.
James E. Blair32c52482017-07-29 07:49:03 -0700743
744 When a job inherits from a parent, the child's pre-run playbooks
745 are run after the parent's. See :ref:`job` for more
746 information.
747
748 .. attr:: post-run
749
James E. Blair68286562017-10-26 10:55:16 -0700750 The name of a playbook or list of playbooks to run after the
751 main body of a job. The full path to the playbook in the repo
752 where the job is defined is expected.
James E. Blair32c52482017-07-29 07:49:03 -0700753
754 When a job inherits from a parent, the child's post-run
755 playbooks are run before the parent's. See :ref:`job` for more
756 information.
757
758 .. attr:: run
759
James E. Blair68286562017-10-26 10:55:16 -0700760 The name of the main playbook for this job. If it is not
761 supplied, the parent's playbook will be used (and likewise up
762 the inheritance chain). The full path within the repo is
763 required. Example:
James E. Blair32c52482017-07-29 07:49:03 -0700764
765 .. code-block:: yaml
766
James E. Blair68286562017-10-26 10:55:16 -0700767 run: playbooks/job-playbook.yaml
768
James E. Blair32c52482017-07-29 07:49:03 -0700769 .. attr:: roles
770
771 A list of Ansible roles to prepare for the job. Because a job
772 runs an Ansible playbook, any roles which are used by the job
773 must be prepared and installed by Zuul before the job begins.
774 This value is a list of dictionaries, each of which indicates
775 one of two types of roles: a Galaxy role, which is simply a role
776 that is installed from Ansible Galaxy, or a Zuul role, which is
777 a role provided by a project managed by Zuul. Zuul roles are
778 able to benefit from speculative merging and cross-project
779 dependencies when used by playbooks in untrusted projects.
780 Roles are added to the Ansible role path in the order they
781 appear on the job -- roles earlier in the list will take
782 precedence over those which follow.
783
784 In the case of job inheritance or variance, the roles used for
785 each of the playbooks run by the job will be only those which
786 were defined along with that playbook. If a child job inherits
787 from a parent which defines a pre and post playbook, then the
788 pre and post playbooks it inherits from the parent job will run
789 only with the roles that were defined on the parent. If the
790 child adds its own pre and post playbooks, then any roles added
791 by the child will be available to the child's playbooks. This
792 is so that a job which inherits from a parent does not
James E. Blairac3c7ae2017-07-31 09:01:08 -0700793 inadvertently alter the behavior of the parent's playbooks by
James E. Blair32c52482017-07-29 07:49:03 -0700794 the addition of conflicting roles. Roles added by a child will
795 appear before those it inherits from its parent.
796
797 A project which supplies a role may be structured in one of two
798 configurations: a bare role (in which the role exists at the
799 root of the project), or a contained role (in which the role
James E. Blairac3c7ae2017-07-31 09:01:08 -0700800 exists within the ``roles/`` directory of the project, perhaps
James E. Blair32c52482017-07-29 07:49:03 -0700801 along with other roles). In the case of a contained role, the
James E. Blairac3c7ae2017-07-31 09:01:08 -0700802 ``roles/`` directory of the project is added to the role search
James E. Blair32c52482017-07-29 07:49:03 -0700803 path. In the case of a bare role, the project itself is added
804 to the role search path. In case the name of the project is not
805 the name under which the role should be installed (and therefore
James E. Blairac3c7ae2017-07-31 09:01:08 -0700806 referenced from Ansible), the ``name`` attribute may be used to
James E. Blair32c52482017-07-29 07:49:03 -0700807 specify an alternate.
808
809 A job automatically has the project in which it is defined added
810 to the roles path if that project appears to contain a role or
James E. Blairac3c7ae2017-07-31 09:01:08 -0700811 ``roles/`` directory. By default, the project is added to the
James E. Blair32c52482017-07-29 07:49:03 -0700812 path under its own name, however, that may be changed by
813 explicitly listing the project in the roles list in the usual
814 way.
815
816 .. note:: Galaxy roles are not yet implemented.
817
818 .. attr:: galaxy
819
820 The name of the role in Ansible Galaxy. If this attribute is
821 supplied, Zuul will search Ansible Galaxy for a role by this
822 name and install it. Mutually exclusive with ``zuul``;
823 either ``galaxy`` or ``zuul`` must be supplied.
824
825 .. attr:: zuul
826
827 The name of a Zuul project which supplies the role. Mutually
828 exclusive with ``galaxy``; either ``galaxy`` or ``zuul`` must
829 be supplied.
830
831 .. attr:: name
832
833 The installation name of the role. In the case of a bare
834 role, the role will be made available under this name.
835 Ignored in the case of a contained role.
836
837 .. attr:: required-projects
838
839 A list of other projects which are used by this job. Any Zuul
840 projects specified here will also be checked out by Zuul into
841 the working directory for the job. Speculative merging and
842 cross-repo dependencies will be honored.
843
844 The format for this attribute is either a list of strings or
845 dictionaries. Strings are interpreted as project names,
846 dictionaries, if used, may have the following attributes:
847
848 .. attr:: name
849 :required:
850
851 The name of the required project.
852
James E. Blairedff2c22017-10-30 14:04:48 -0700853 .. attr:: override-checkout
James E. Blair32c52482017-07-29 07:49:03 -0700854
855 When Zuul runs jobs for a proposed change, it normally checks
856 out the branch associated with that change on every project
857 present in the job. If jobs are running on a ref (such as a
858 branch tip or tag), then that ref is normally checked out.
859 This attribute is used to override that behavior and indicate
860 that this job should, regardless of the branch for the queue
James E. Blairedff2c22017-10-30 14:04:48 -0700861 item, use the indicated ref (i.e., branch or tag) instead,
862 for only this project. See also the
863 :attr:`job.override-checkout` attribute to apply the same
864 behavior to all projects in a job.
James E. Blair32c52482017-07-29 07:49:03 -0700865
James E. Blair7fb04512018-01-23 13:23:13 -0800866 This value is also used to help select which variants of a
867 job to run. If ``override-checkout`` is set, then Zuul will
868 use this value instead of the branch of the item being tested
869 when collecting any jobs to run which are defined in this
870 project.
871
James E. Blair32c52482017-07-29 07:49:03 -0700872 .. attr:: vars
873
874 A dictionary of variables to supply to Ansible. When inheriting
875 from a job (or creating a variant of a job) vars are merged with
876 previous definitions. This means a variable definition with the
877 same name will override a previously defined variable, but new
878 variable names will be added to the set of defined variables.
879
James E. Blair67cd8592018-02-14 09:30:07 -0800880 .. attr:: host_vars
881
882 A dictionary of host variables to supply to Ansible. The keys
883 of this dictionary are node names as defined in a
884 :ref:`nodeset`, and the values are dictionaries of variables,
885 just as in :attr:`job.vars`.
886
887 .. attr:: group_vars
888
889 A dictionary of group variables to supply to Ansible. The keys
890 of this dictionary are node groups as defined in a
891 :ref:`nodeset`, and the values are dictionaries of variables,
892 just as in :attr:`job.vars`.
893
894 An example of three kinds of variables:
895
896 .. code-block:: yaml
897
898 - job:
899 name: variable-example
900 nodeset:
901 nodes:
902 - name: controller
903 label: fedora-27
904 - name: api1
905 label: centos-7
906 - name: api2
907 label: centos-7
908 groups:
909 - name: api
910 nodes:
911 - api1
912 - api2
913 vars:
914 foo: "this variable is visible to all nodes"
915 host_vars:
916 controller:
917 bar: "this variable is visible only on the controller node"
918 group_vars:
919 api:
920 baz: "this variable is visible on api1 and api2"
921
James E. Blair32c52482017-07-29 07:49:03 -0700922 .. attr:: dependencies
923
924 A list of other jobs upon which this job depends. Zuul will not
925 start executing this job until all of its dependencies have
926 completed successfully, and if one or more of them fail, this
927 job will not be run.
928
929 .. attr:: allowed-projects
930
931 A list of Zuul projects which may use this job. By default, a
932 job may be used by any other project known to Zuul, however,
933 some jobs use resources or perform actions which are not
934 appropriate for other projects. In these cases, a list of
935 projects which are allowed to use this job may be supplied. If
936 this list is not empty, then it must be an exhaustive list of
937 all projects permitted to use the job. The current project
938 (where the job is defined) is not automatically included, so if
939 it should be able to run this job, then it must be explicitly
James E. Blair88d84242017-07-31 12:05:16 -0700940 listed. By default, all projects may use the job.
James E. Blair1de8d402017-05-07 17:08:04 -0700941
James E. Blair8eb564a2017-08-10 09:21:41 -0700942 .. attr:: post-review
943 :default: false
James E. Blair892cca62017-08-09 11:36:58 -0700944
James E. Blair8eb564a2017-08-10 09:21:41 -0700945 A boolean value which indicates whether this job may only be
946 used in pipelines where :attr:`pipeline.post-review` is
Monty Taylora49b0ea2017-10-05 16:16:19 -0500947 ``true``. This is automatically set to ``true`` if this job
948 uses a :ref:`secret` and is defined in a :term:`untrusted-project`.
949 It may be explicitly set to obtain the same behavior for jobs
950 defined in :term:`config projects <config-project>`. Once this
951 is set to ``true`` anywhere in the inheritance hierarchy for a job,
952 it will remain set for all child jobs and variants (it can not be
James E. Blair8eb564a2017-08-10 09:21:41 -0700953 set to ``false``).
James E. Blair1de8d402017-05-07 17:08:04 -0700954
James E. Blair5a2bce72017-12-13 09:24:30 -0800955 .. _matchers:
956
957 The following job attributes are considered "matchers". They are
958 not inherited in the usual manner, instead, these attributes are
959 used to determine whether a specific variant is used when
960 running a job.
961
962 .. attr:: branches
963
964 A regular expression (or list of regular expressions) which
965 describe on what branches a job should run (or in the case of
966 variants: to alter the behavior of a job for a certain branch).
967
968 If there is no job definition for a given job which matches the
969 branch of an item, then that job is not run for the item.
970 Otherwise, all of the job variants which match that branch (and
971 any other selection criteria) are used when freezing the job.
James E. Blair7fb04512018-01-23 13:23:13 -0800972 However, if :attr:`job.override-checkout` or
973 :attr:`job.required-projects.override-checkout` are set for a
974 project, Zuul will attempt to use the job variants which match
975 the values supplied in ``override-checkout`` for jobs defined in
976 those projects. This can be used to run a job defined in one
977 project on another project without a matching branch.
James E. Blair5a2bce72017-12-13 09:24:30 -0800978
979 This example illustrates a job called *run-tests* which uses a
980 nodeset based on the current release of an operating system to
981 perform its tests, except when testing changes to the stable/2.0
982 branch, in which case it uses an older release:
983
984 .. code-block:: yaml
985
986 - job:
987 name: run-tests
988 nodeset: current-release
989
990 - job:
991 name: run-tests
992 branches: stable/2.0
993 nodeset: old-release
994
995 In some cases, Zuul uses an implied value for the branch
996 specifier if none is supplied:
997
998 * For a job definition in a :term:`config-project`, no implied
999 branch specifier is used. If no branch specifier appears, the
1000 job applies to all branches.
1001
1002 * In the case of an :term:`untrusted-project`, if the project
1003 has only one branch, no implied branch specifier is applied to
1004 :ref:`job` definitions. If the project has more than one
1005 branch, the branch containing the job definition is used as an
1006 implied branch specifier.
1007
1008 * In the case of a job variant defined within a :ref:`project`,
1009 if the project definition is in a :term:`config-project`, no
1010 implied branch specifier is used. If it appears in an
1011 :term:`untrusted-project`, with no branch specifier, the
1012 branch containing the project definition is used as an implied
1013 branch specifier.
1014
1015 * In the case of a job variant defined within a
1016 :ref:`project-template`, if no branch specifier appears, the
1017 implied branch containing the project-template definition is
1018 used as an implied branch specifier. This means that
1019 definitions of the same project-template on different branches
1020 may run different jobs.
1021
1022 When that project-template is used by a :ref:`project`
1023 definition within a :term:`untrusted-project`, the branch
1024 containing that project definition is combined with the branch
1025 specifier of the project-template. This means it is possible
1026 for a project to use a template on one branch, but not on
1027 another.
1028
1029 This allows for the very simple and expected workflow where if a
1030 project defines a job on the ``master`` branch with no branch
1031 specifier, and then creates a new branch based on ``master``,
1032 any changes to that job definition within the new branch only
1033 affect that branch, and likewise, changes to the master branch
1034 only affect it.
1035
1036 See :attr:`pragma.implied-branch-matchers` for how to override
1037 this behavior on a per-file basis.
1038
1039 .. attr:: files
1040
1041 This matcher indicates that the job should only run on changes
1042 where the specified files are modified. This is a regular
1043 expression or list of regular expressions.
1044
1045 .. attr:: irrelevant-files
1046
1047 This matcher is a negative complement of **files**. It
1048 indicates that the job should run unless *all* of the files
1049 changed match this list. In other words, if the regular
1050 expression ``docs/.*`` is supplied, then this job will not run
1051 if the only files changed are in the docs directory. A regular
1052 expression or list of regular expressions.
1053
James E. Blair1de8d402017-05-07 17:08:04 -07001054.. _project:
1055
1056Project
1057~~~~~~~
1058
1059A project corresponds to a source code repository with which Zuul is
James E. Blairac3c7ae2017-07-31 09:01:08 -07001060configured to interact. The main responsibility of the project
James E. Blair1de8d402017-05-07 17:08:04 -07001061configuration item is to specify which jobs should run in which
James E. Blairac3c7ae2017-07-31 09:01:08 -07001062pipelines for a given project. Within each project definition, a
1063section for each :ref:`pipeline <pipeline>` may appear. This
1064project-pipeline definition is what determines how a project
1065participates in a pipeline.
James E. Blair1de8d402017-05-07 17:08:04 -07001066
James E. Blair0b7dc852017-10-10 13:41:03 -07001067Multiple project definitions may appear for the same project (for
Monty Taylor44812322017-10-21 15:35:03 +02001068example, in a central :term:`config projects <config-project>` as well
James E. Blair0b7dc852017-10-10 13:41:03 -07001069as in a repo's own ``.zuul.yaml``). In this case, all of the project
1070definitions are combined (the jobs listed in all of the definitions
1071will be run).
1072
James E. Blairac3c7ae2017-07-31 09:01:08 -07001073Consider the following project definition::
James E. Blair1de8d402017-05-07 17:08:04 -07001074
1075 - project:
1076 name: yoyodyne
1077 check:
1078 jobs:
1079 - check-syntax
1080 - unit-tests
1081 gate:
1082 queue: integrated
1083 jobs:
1084 - unit-tests
1085 - integration-tests
1086
James E. Blairac3c7ae2017-07-31 09:01:08 -07001087The project has two project-pipeline stanzas, one for the ``check``
1088pipeline, and one for ``gate``. Each specifies which jobs should run
1089when a change for that project enters the respective pipeline -- when
1090a change enters ``check``, the ``check-syntax`` and ``unit-test`` jobs
1091are run.
James E. Blair1de8d402017-05-07 17:08:04 -07001092
James E. Blairac3c7ae2017-07-31 09:01:08 -07001093Pipelines which use the dependent pipeline manager (e.g., the ``gate``
James E. Blair1de8d402017-05-07 17:08:04 -07001094example shown earlier) maintain separate queues for groups of
1095projects. When Zuul serializes a set of changes which represent
1096future potential project states, it must know about all of the
1097projects within Zuul which may have an effect on the outcome of the
1098jobs it runs. If project *A* uses project *B* as a library, then Zuul
1099must be told about that relationship so that it knows to serialize
1100changes to A and B together, so that it does not merge a change to B
1101while it is testing a change to A.
1102
1103Zuul could simply assume that all projects are related, or even infer
1104relationships by which projects a job indicates it uses, however, in a
1105large system that would become unwieldy very quickly, and
1106unnecessarily delay changes to unrelated projects. To allow for
1107flexibility in the construction of groups of related projects, the
1108change queues used by dependent pipeline managers are specified
1109manually. To group two or more related projects into a shared queue
1110for a dependent pipeline, set the ``queue`` parameter to the same
1111value for those projects.
1112
James E. Blairac3c7ae2017-07-31 09:01:08 -07001113The ``gate`` project-pipeline definition above specifies that this
1114project participates in the ``integrated`` shared queue for that
James E. Blair1de8d402017-05-07 17:08:04 -07001115pipeline.
1116
James E. Blair9d4384d2017-08-01 15:54:50 -07001117.. attr:: project
James E. Blair1de8d402017-05-07 17:08:04 -07001118
James E. Blair0b7dc852017-10-10 13:41:03 -07001119 The following attributes may appear in a project:
James E. Blair1de8d402017-05-07 17:08:04 -07001120
James E. Blair9d4384d2017-08-01 15:54:50 -07001121 .. attr:: name
James E. Blair9d4384d2017-08-01 15:54:50 -07001122
1123 The name of the project. If Zuul is configured with two or more
1124 unique projects with the same name, the canonical hostname for
1125 the project should be included (e.g., `git.example.com/foo`).
Tobias Henkele9a22512017-12-22 08:36:12 +01001126 If not given it is implicitly derived from the project where this
1127 is defined.
James E. Blair9d4384d2017-08-01 15:54:50 -07001128
1129 .. attr:: templates
1130
1131 A list of :ref:`project-template` references; the
1132 project-pipeline definitions of each Project Template will be
1133 applied to this project. If more than one template includes
1134 jobs for a given pipeline, they will be combined, as will any
1135 jobs specified in project-pipeline definitions on the project
1136 itself.
1137
1138 .. attr:: merge-mode
1139 :default: merge-resolve
1140
1141 The merge mode which is used by Git for this project. Be sure
1142 this matches what the remote system which performs merges (i.e.,
1143 Gerrit or GitHub). Must be one of the following values:
1144
1145 .. value:: merge
1146
1147 Uses the default git merge strategy (recursive).
1148
1149 .. value:: merge-resolve
1150
1151 Uses the resolve git merge strategy. This is a very
1152 conservative merge strategy which most closely matches the
1153 behavior of Gerrit.
1154
1155 .. value:: cherry-pick
1156
1157 Cherry-picks each change onto the branch rather than
1158 performing any merges.
1159
1160 .. attr:: <pipeline>
1161
1162 Each pipeline that the project participates in should have an
1163 entry in the project. The value for this key should be a
1164 dictionary with the following format:
1165
1166 .. attr:: jobs
1167 :required:
1168
1169 A list of jobs that should be run when items for this project
1170 are enqueued into the pipeline. Each item of this list may
1171 be a string, in which case it is treated as a job name, or it
1172 may be a dictionary, in which case it is treated as a job
1173 variant local to this project and pipeline. In that case,
1174 the format of the dictionary is the same as the top level
1175 :attr:`job` definition. Any attributes set on the job here
1176 will override previous versions of the job.
1177
1178 .. attr:: queue
1179
1180 If this pipeline is a :value:`dependent
1181 <pipeline.manager.dependent>` pipeline, this specifies the
1182 name of the shared queue this project is in. Any projects
1183 which interact with each other in tests should be part of the
1184 same shared queue in order to ensure that they don't merge
1185 changes which break the others. This is a free-form string;
1186 just set the same value for each group of projects.
James E. Blair1de8d402017-05-07 17:08:04 -07001187
James E. Blair1ef8f7c2017-12-13 17:18:34 -08001188 .. attr:: debug
1189
1190 If this is set to `true`, Zuul will include debugging
1191 information in reports it makes about items in the pipeline.
1192 This should not normally be set, but in situations were it is
1193 difficult to determine why Zuul did or did not run a certain
1194 job, the additional information this provides may help.
1195
James E. Blair1de8d402017-05-07 17:08:04 -07001196.. _project-template:
1197
1198Project Template
1199~~~~~~~~~~~~~~~~
1200
1201A Project Template defines one or more project-pipeline definitions
1202which can be re-used by multiple projects.
1203
1204A Project Template uses the same syntax as a :ref:`project`
James E. Blairaafabe92017-08-02 15:23:19 -07001205definition, however, in the case of a template, the
1206:attr:`project.name` attribute does not refer to the name of a
1207project, but rather names the template so that it can be referenced in
1208a `Project` definition.
James E. Blair1de8d402017-05-07 17:08:04 -07001209
1210.. _secret:
1211
1212Secret
1213~~~~~~
1214
1215A Secret is a collection of private data for use by one or more jobs.
1216In order to maintain the security of the data, the values are usually
1217encrypted, however, data which are not sensitive may be provided
1218unencrypted as well for convenience.
1219
James E. Blaira17a8e72018-01-17 13:45:25 -08001220A Secret may only be used by jobs defined within the same project.
1221Note that they can be used by any branch of that project, so if a
1222project's branches have different access controls, consider whether
1223all branches of that project are equally trusted before using secrets.
1224
1225To use a secret, a :ref:`job` must specify the secret in
James E. Blaire19e88a2017-08-09 15:14:29 -07001226:attr:`job.secrets`. Secrets are bound to the playbooks associated
1227with the specific job definition where they were declared. Additional
1228pre or post playbooks which appear in child jobs will not have access
1229to the secrets, nor will playbooks which override the main playbook
1230(if any) of the job which declared the secret. This protects against
1231jobs in other repositories declaring a job with a secret as a parent
1232and then exposing that secret.
James E. Blair892cca62017-08-09 11:36:58 -07001233
1234It is possible to use secrets for jobs defined in :term:`config
1235projects <config-project>` as well as :term:`untrusted projects
1236<untrusted-project>`, however their use differs slightly. Because
1237playbooks in a config project which use secrets run in the
1238:term:`trusted execution context` where proposed changes are not used
1239in executing jobs, it is safe for those secrets to be used in all
1240types of pipelines. However, because playbooks defined in an
1241untrusted project are run in the :term:`untrusted execution context`
1242where proposed changes are used in job execution, it is dangerous to
1243allow those secrets to be used in pipelines which are used to execute
James E. Blair8eb564a2017-08-10 09:21:41 -07001244proposed but unreviewed changes. By default, pipelines are considered
1245`pre-review` and will refuse to run jobs which have playbooks that use
1246secrets in the untrusted execution context to protect against someone
1247proposing a change which exposes a secret. To permit this (for
1248instance, in a pipeline which only runs after code review), the
1249:attr:`pipeline.post-review` attribute may be explicitly set to
1250``true``.
1251
1252In some cases, it may be desirable to prevent a job which is defined
1253in a config project from running in a pre-review pipeline (e.g., a job
1254used to publish an artifact). In these cases, the
1255:attr:`job.post-review` attribute may be explicitly set to ``true`` to
1256indicate the job should only run in post-review pipelines.
James E. Blair892cca62017-08-09 11:36:58 -07001257
1258If a job with secrets is unsafe to be used by other projects, the
1259`allowed-projects` job attribute can be used to restrict the projects
1260which can invoke that job.
James E. Blair1de8d402017-05-07 17:08:04 -07001261
James E. Blair0b856f52018-01-22 16:29:53 -08001262Secrets, like most configuration items, are unique within a tenant,
1263though a secret may be defined on multiple branches of the same
1264project as long as the contents are the same. This is to aid in
1265branch maintenance, so that creating a new branch based on an existing
1266branch will not immediately produce a configuration error.
James E. Blaira17a8e72018-01-17 13:45:25 -08001267
James E. Blairaafabe92017-08-02 15:23:19 -07001268.. attr:: secret
James E. Blair1de8d402017-05-07 17:08:04 -07001269
James E. Blairaafabe92017-08-02 15:23:19 -07001270 The following attributes must appear on a secret:
James E. Blair1de8d402017-05-07 17:08:04 -07001271
James E. Blairaafabe92017-08-02 15:23:19 -07001272 .. attr:: name
1273 :required:
1274
1275 The name of the secret, used in a :ref:`Job` definition to
1276 request the secret.
1277
1278 .. attr:: data
1279 :required:
1280
1281 A dictionary which will be added to the Ansible variables
1282 available to the job. The values can either be plain text
1283 strings, or encrypted values. See :ref:`encryption` for more
1284 information.
James E. Blair1de8d402017-05-07 17:08:04 -07001285
1286.. _nodeset:
1287
1288Nodeset
1289~~~~~~~
1290
1291A Nodeset is a named collection of nodes for use by a job. Jobs may
1292specify what nodes they require individually, however, by defining
1293groups of node types once and referring to them by name, job
1294configuration may be simplified.
1295
James E. Blair0b856f52018-01-22 16:29:53 -08001296Nodesets, like most configuration items, are unique within a tenant,
1297though a nodeset may be defined on multiple branches of the same
1298project as long as the contents are the same. This is to aid in
1299branch maintenance, so that creating a new branch based on an existing
1300branch will not immediately produce a configuration error.
James E. Blair8446c412018-01-17 15:49:59 -08001301
Tobias Henkeldb686e22017-08-01 09:15:31 +02001302.. code-block:: yaml
James E. Blair1de8d402017-05-07 17:08:04 -07001303
Tobias Henkeldb686e22017-08-01 09:15:31 +02001304 - nodeset:
1305 name: nodeset1
1306 nodes:
1307 - name: controller
1308 label: controller-label
1309 - name: compute1
1310 label: compute-label
Paul Belangerecb0b842017-11-18 15:23:29 -05001311 - name:
1312 - compute2
1313 - web
Tobias Henkeldb686e22017-08-01 09:15:31 +02001314 label: compute-label
1315 groups:
1316 - name: ceph-osd
1317 nodes:
1318 - controller
1319 - name: ceph-monitor
1320 nodes:
1321 - controller
1322 - compute1
1323 - compute2
Paul Belangerecb0b842017-11-18 15:23:29 -05001324 - name: ceph-web
1325 nodes:
1326 - web
James E. Blair1de8d402017-05-07 17:08:04 -07001327
Tobias Henkeldb686e22017-08-01 09:15:31 +02001328.. attr:: nodeset
James E. Blair1de8d402017-05-07 17:08:04 -07001329
Tobias Henkeldb686e22017-08-01 09:15:31 +02001330 A Nodeset requires two attributes:
James E. Blair1de8d402017-05-07 17:08:04 -07001331
Tobias Henkeldb686e22017-08-01 09:15:31 +02001332 .. attr:: name
1333 :required:
1334
1335 The name of the Nodeset, to be referenced by a :ref:`job`.
1336
1337 .. attr:: nodes
1338 :required:
1339
1340 A list of node definitions, each of which has the following format:
1341
1342 .. attr:: name
1343 :required:
1344
1345 The name of the node. This will appear in the Ansible inventory
1346 for the job.
1347
Paul Belangerecb0b842017-11-18 15:23:29 -05001348 This can also be as a list of strings. If so, then the list of hosts in
1349 the Ansible inventory will share a common ansible_host address.
1350
Tobias Henkeldb686e22017-08-01 09:15:31 +02001351 .. attr:: label
1352 :required:
1353
1354 The Nodepool label for the node. Zuul will request a node with
1355 this label.
1356
1357 .. attr:: groups
1358
1359 Additional groups can be defined which are accessible from the ansible
1360 playbooks.
1361
1362 .. attr:: name
1363 :required:
1364
1365 The name of the group to be referenced by an ansible playbook.
1366
1367 .. attr:: nodes
1368 :required:
1369
1370 The nodes that shall be part of the group. This is specified as a list
1371 of strings.
James E. Blair1de8d402017-05-07 17:08:04 -07001372
1373.. _semaphore:
1374
1375Semaphore
1376~~~~~~~~~
1377
1378Semaphores can be used to restrict the number of certain jobs which
1379are running at the same time. This may be useful for jobs which
1380access shared or limited resources. A semaphore has a value which
1381represents the maximum number of jobs which use that semaphore at the
1382same time.
1383
James E. Blair0b856f52018-01-22 16:29:53 -08001384Semaphores, like most configuration items, are unique within a tenant,
1385though a semaphore may be defined on multiple branches of the same
1386project as long as the value is the same. This is to aid in branch
1387maintenance, so that creating a new branch based on an existing branch
1388will not immediately produce a configuration error.
James E. Blair9596b942018-01-18 14:21:44 -08001389
James E. Blair1de8d402017-05-07 17:08:04 -07001390Semaphores are never subject to dynamic reconfiguration. If the value
1391of a semaphore is changed, it will take effect only when the change
James E. Blair9596b942018-01-18 14:21:44 -08001392where it is updated is merged. However, Zuul will attempt to validate
1393the configuration of semaphores in proposed updates, even if they
1394aren't used.
1395
1396An example usage of semaphores follows:
James E. Blair1de8d402017-05-07 17:08:04 -07001397
Tobias Henkel76832982017-08-01 08:37:40 +02001398.. code-block:: yaml
James E. Blair1de8d402017-05-07 17:08:04 -07001399
Tobias Henkel76832982017-08-01 08:37:40 +02001400 - semaphore:
1401 name: semaphore-foo
1402 max: 5
1403 - semaphore:
1404 name: semaphore-bar
1405 max: 3
James E. Blair1de8d402017-05-07 17:08:04 -07001406
Tobias Henkel76832982017-08-01 08:37:40 +02001407.. attr:: semaphore
James E. Blair1de8d402017-05-07 17:08:04 -07001408
Tobias Henkel76832982017-08-01 08:37:40 +02001409 The following attributes are available:
1410
1411 .. attr:: name
1412 :required:
1413
1414 The name of the semaphore, referenced by jobs.
1415
1416 .. attr:: max
1417 :default: 1
1418
1419 The maximum number of running jobs which can use this semaphore.
James E. Blair7edc25f2017-10-26 10:47:14 -07001420
1421.. _pragma:
1422
1423Pragma
1424~~~~~~
1425
1426The `pragma` item does not behave like the others. It can not be
1427included or excluded from configuration loading by the administrator,
1428and does not form part of the final configuration itself. It is used
1429to alter how the configuration is processed while loading.
1430
1431A pragma item only affects the current file. The same file in another
1432branch of the same project will not be affected, nor any other files
1433or any other projects. The effect is global within that file --
1434pragma directives may not be set and then unset within the same file.
1435
1436.. code-block:: yaml
1437
1438 - pragma:
1439 implied-branch-matchers: False
1440
1441.. attr:: pragma
1442
James E. Blair37c3d8c2017-12-13 15:06:11 -08001443 The pragma item currently supports the following attributes:
James E. Blair7edc25f2017-10-26 10:47:14 -07001444
1445 .. attr:: implied-branch-matchers
1446
1447 This is a boolean, which, if set, may be used to enable
1448 (``True``) or disable (``False``) the addition of implied branch
1449 matchers to job definitions. Normally Zuul decides whether to
1450 add these based on heuristics described in :attr:`job.branches`.
1451 This attribute overrides that behavior.
1452
1453 This can be useful if a project has multiple branches, yet the
1454 jobs defined in the master branch should apply to all branches.
1455
1456 Note that if a job contains an explicit branch matcher, it will
1457 be used regardless of the value supplied here.
James E. Blair37c3d8c2017-12-13 15:06:11 -08001458
1459 .. attr:: implied-branches
1460
1461 This is a list of regular expressions, just as
1462 :attr:`job.branches`, which may be used to supply the value of
1463 the implied branch matcher for all jobs in a file.
1464
1465 This may be useful if two projects share jobs but have
1466 dissimilar branch names. If, for example, two projects have
1467 stable maintenance branches with dissimilar names, but both
1468 should use the same job variants, this directive may be used to
1469 indicate that all of the jobs defined in the stable branch of
James E. Blair1012a7b2017-12-15 09:58:05 -08001470 the first project may also be used for the stable branch of the
James E. Blair37c3d8c2017-12-13 15:06:11 -08001471 other. For example:
1472
1473 .. code-block:: yaml
1474
1475 - pragma:
1476 implied-branches:
1477 - stable/foo
1478 - stable/bar
1479
1480 The above code, when added to the ``stable/foo`` branch of a
1481 project would indicate that the job variants described in that
1482 file should not only be used for changes to ``stable/foo``, but
1483 also on changes to ``stable/bar``, which may be in another
1484 project.
1485
1486 Note that if a job contains an explicit branch matcher, it will
1487 be used regardless of the value supplied here.
1488
1489 Note also that the presence of `implied-branches` does not
1490 automatically set `implied-branch-matchers`. Zuul will still
1491 decide if implied branch matchers are warranted at all, using
1492 the heuristics described in :attr:`job.branches`, and only use
1493 the value supplied here if that is the case. If you want to
1494 declare specific implied branches on, for example, a
1495 :term:`config-project` project (which normally would not use
1496 implied branches), you must set `implied-branch-matchers` as
1497 well.