James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1 | :title: Project Configuration |
| 2 | |
| 3 | .. _project-config: |
| 4 | |
| 5 | Project Configuration |
| 6 | ===================== |
| 7 | |
| 8 | The following sections describe the main part of Zuul's configuration. |
| 9 | All of what follows is found within files inside of the repositories |
| 10 | that Zuul manages. |
| 11 | |
| 12 | Security Contexts |
| 13 | ----------------- |
| 14 | |
| 15 | When a system administrator configures Zuul to operate on a project, |
| 16 | they specify one of two security contexts for that project. A |
| 17 | *config-project* is one which is primarily tasked with holding |
| 18 | configuration information and job content for Zuul. Jobs which are |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 19 | defined in a config-project are run with elevated privileges, and all |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 20 | Zuul configuration items are available for use. Base jobs (that is, |
| 21 | jobs without a parent) may only be defined in config-projects. It is |
| 22 | expected that changes to config-projects will undergo careful scrutiny |
| 23 | before being merged. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 24 | |
| 25 | An *untrusted-project* is a project whose primary focus is not to |
| 26 | operate Zuul, but rather it is one of the projects being tested or |
| 27 | deployed. The Zuul configuration language available to these projects |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 28 | is somewhat restricted (as detailed in individual sections below), and |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 29 | jobs defined in these projects run in a restricted execution |
| 30 | environment since they may be operating on changes which have not yet |
| 31 | undergone review. |
| 32 | |
| 33 | Configuration Loading |
| 34 | --------------------- |
| 35 | |
| 36 | When Zuul starts, it examines all of the git repositories which are |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 37 | specified by the system administrator in :ref:`tenant-config` and |
| 38 | searches for files in the root of each repository. Zuul looks first |
| 39 | for a file named ``zuul.yaml`` or a directory named ``zuul.d``, and if |
| 40 | they are not found, ``.zuul.yaml`` or ``.zuul.d`` (with a leading |
| 41 | dot). In the case of an :term:`untrusted-project`, the configuration |
| 42 | from every branch is included, however, in the case of a |
| 43 | :term:`config-project`, only the ``master`` branch is examined. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 44 | |
| 45 | When a change is proposed to one of these files in an |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 46 | untrusted-project, the configuration proposed in the change is merged |
| 47 | into the running configuration so that any changes to Zuul's |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 48 | configuration are self-testing as part of that change. If there is a |
| 49 | configuration error, no jobs will be run and the error will be |
| 50 | reported by any applicable pipelines. In the case of a change to a |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 51 | config-project, the new configuration is parsed and examined for |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 52 | errors, but the new configuration is not used in testing the change. |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 53 | This is because configuration in config-projects is able to access |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 54 | elevated privileges and should always be reviewed before being merged. |
| 55 | |
| 56 | As soon as a change containing a Zuul configuration change merges to |
| 57 | any Zuul-managed repository, the new configuration takes effect |
| 58 | immediately. |
| 59 | |
Monty Taylor | db39bbb | 2017-08-23 17:24:00 -0400 | [diff] [blame] | 60 | .. _configuration-items: |
| 61 | |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 62 | Configuration Items |
| 63 | ------------------- |
| 64 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 65 | The ``zuul.yaml`` and ``.zuul.yaml`` configuration files are |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 66 | YAML-formatted and are structured as a series of items, each of which |
| 67 | is described below. |
| 68 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 69 | In the case of a ``zuul.d`` directory, Zuul recurses the directory and |
| 70 | extends the configuration using all the .yaml files in the sorted path |
| 71 | order. For example, to keep job's variants in a separate file, it |
| 72 | needs to be loaded after the main entries, for example using number |
| 73 | prefixes in file's names:: |
Tristan Cacqueray | 4a01583 | 2017-07-11 05:18:14 +0000 | [diff] [blame] | 74 | |
| 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 80 | .. _pipeline: |
| 81 | |
| 82 | Pipeline |
| 83 | ~~~~~~~~ |
| 84 | |
| 85 | A pipeline describes a workflow operation in Zuul. It associates jobs |
| 86 | for a given project with triggering and reporting events. |
| 87 | |
| 88 | Its flexible configuration allows for characterizing any number of |
| 89 | workflows, and by specifying each as a named configuration, makes it |
| 90 | easy to apply similar workflow operations to projects or groups of |
| 91 | projects. |
| 92 | |
| 93 | By way of example, one of the primary uses of Zuul is to perform |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 94 | project gating. To do so, one can create a :term:`gate` pipeline |
| 95 | which tells Zuul that when a certain event (such as approval by a code |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 96 | reviewer) occurs, the corresponding change or pull request should be |
| 97 | enqueued into the pipeline. When that happens, the jobs which have |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 98 | been configured to run for that project in the gate pipeline are run, |
| 99 | and when they complete, the pipeline reports the results to the user. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 100 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 101 | Pipeline configuration items may only appear in :term:`config-projects |
| 102 | <config-project>`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 103 | |
| 104 | Generally, a Zuul administrator would define a small number of |
| 105 | pipelines which represent the workflow processes used in their |
| 106 | environment. Each project can then be added to the available |
| 107 | pipelines as appropriate. |
| 108 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 109 | Here is an example :term:`check` pipeline, which runs whenever a new |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 110 | patchset is created in Gerrit. If the associated jobs all report |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 111 | success, the pipeline reports back to Gerrit with ``Verified`` vote of |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 112 | +1, or if at least one of them fails, a -1: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 113 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 114 | .. 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 128 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 129 | .. TODO: See TODO for more annotated examples of common pipeline configurations. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 130 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 131 | .. attr:: pipeline |
James E. Blair | 7145c58 | 2017-07-26 13:30:39 -0700 | [diff] [blame] | 132 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 133 | The attributes available on a pipeline are as follows (all are |
| 134 | optional unless otherwise specified): |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 135 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 136 | .. attr:: name |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 137 | :required: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 138 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 139 | This is used later in the project definition to indicate what jobs |
| 140 | should be run for events in the pipeline. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 141 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 142 | .. attr:: manager |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 143 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 144 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 145 | There are currently two schemes for managing pipelines: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 146 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 147 | .. value:: independent |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 148 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 149 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 160 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 161 | 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. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 164 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 165 | .. value:: dependent |
James E. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 166 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 167 | 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. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 185 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 186 | For more detail on the theory and operation of Zuul's |
| 187 | dependent pipeline manager, see: :doc:`gating`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 188 | |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 189 | .. attr:: post-review |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 190 | :default: false |
James E. Blair | f17aa9c | 2017-07-05 13:21:23 -0700 | [diff] [blame] | 191 | |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 192 | 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. Blair | f17aa9c | 2017-07-05 13:21:23 -0700 | [diff] [blame] | 199 | |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 200 | For more information, see :ref:`secret` and |
| 201 | :attr:`job.post-review`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 202 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 203 | .. attr:: description |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 204 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 205 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 207 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 208 | .. attr:: success-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 209 | :default: Build successful. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 210 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 211 | The introductory text in reports when all the voting jobs are |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 212 | successful. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 213 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 214 | .. attr:: failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 215 | :default: Build failed. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 216 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 217 | The introductory text in reports when at least one voting job |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 218 | fails. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 219 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 220 | .. attr:: merge-failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 221 | :default: Merge failed. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 222 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 223 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 226 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 227 | .. attr:: footer-message |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 228 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 229 | Supplies additional information after test results. Useful for |
| 230 | adding information about the CI system such as debugging and |
| 231 | contact details. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 232 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 233 | .. attr:: trigger |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 234 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 235 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 239 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 240 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 243 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 244 | .. attr:: require |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 245 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 246 | If this section is present, it establishes prerequisites for |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 247 | 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. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 250 | item will not be enqueued. These requirements may vary |
| 251 | depending on the source of the item being enqueued. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 252 | |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 253 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 256 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 257 | .. attr:: reject |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 258 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 259 | If this section is present, it establishes prerequisites that |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 260 | can block an item from being enqueued. It can be considered a |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 261 | negative version of :attr:`pipeline.require`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 262 | |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 263 | 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. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 266 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 267 | .. attr:: dequeue-on-new-patchset |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 268 | :default: true |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 269 | |
| 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. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 274 | continue running), set this to ``false``. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 275 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 276 | .. attr:: ignore-dependencies |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 277 | :default: false |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 278 | |
| 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. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 285 | dependent pipelines. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 286 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 287 | .. attr:: precedence |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 288 | :default: normal |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 289 | |
| 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. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 296 | .. _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. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 305 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 306 | .. attr:: success |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 307 | |
| 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. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 311 | 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. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 315 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 316 | .. attr:: failure |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 317 | |
| 318 | These reporters describe what Zuul should do if at least one job |
| 319 | fails. |
| 320 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 321 | .. attr:: merge-failure |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 322 | |
| 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. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 328 | .. attr:: start |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 329 | |
| 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. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 334 | .. attr:: disabled |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 335 | |
| 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. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 344 | .. attr:: disable-after-consecutive-failures |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 345 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 346 | If set, a pipeline can enter a *disabled* state if too many |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 347 | changes in a row fail. When this value is exceeded the pipeline |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 348 | 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. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 351 | pipeline is disabled). |
| 352 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 353 | .. attr:: window |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 354 | :default: 20 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 355 | |
| 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. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 362 | limiting on the :value:`dependent pipeline manager |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 363 | <pipeline.manager.dependent>`. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 364 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 365 | .. attr:: window-floor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 366 | :default: 3 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 367 | |
| 368 | Dependent pipeline managers only. This is the minimum value for |
| 369 | the window described above. Should be a positive non zero |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 370 | integer value. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 371 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 372 | .. attr:: window-increase-type |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 373 | :default: linear |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 374 | |
| 375 | Dependent pipeline managers only. This value describes how the |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 376 | 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. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 381 | the previous window value. |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 382 | |
| 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. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 388 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 389 | .. attr:: window-increase-factor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 390 | :default: 1 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 391 | |
| 392 | Dependent pipeline managers only. The value to be added or |
| 393 | multiplied against the previous window value to determine the |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 394 | new window after successful change merges. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 395 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 396 | .. attr:: window-decrease-type |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 397 | :default: exponential |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 398 | |
| 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. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 401 | 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. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 412 | the window size. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 413 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 414 | .. attr:: window-decrease-factor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 415 | :default: 2 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 416 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 417 | :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. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 420 | new window after unsuccessful change merges. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 421 | |
| 422 | |
| 423 | .. _job: |
| 424 | |
| 425 | Job |
| 426 | ~~~ |
| 427 | |
| 428 | A job is a unit of work performed by Zuul on an item enqueued into a |
| 429 | pipeline. Items may run any number of jobs (which may depend on each |
| 430 | other). Each job is an invocation of an Ansible playbook with a |
| 431 | specific inventory of hosts. The actual tasks that are run by the job |
| 432 | appear in the playbook for that job while the attributes that appear in the |
| 433 | Zuul configuration specify information about when, where, and how the |
| 434 | job should be run. |
| 435 | |
| 436 | Jobs in Zuul support inheritance. Any job may specify a single parent |
| 437 | job, and any attributes not set on the child job are collected from |
| 438 | the parent job. In this way, a configuration structure may be built |
| 439 | starting with very basic jobs which describe characteristics that all |
| 440 | jobs on the system should have, progressing through stages of |
| 441 | specialization before arriving at a particular job. A job may inherit |
| 442 | from any other job in any project (however, if the other job is marked |
Tobias Henkel | 8316762 | 2017-06-30 19:45:03 +0200 | [diff] [blame] | 443 | as :attr:`job.final`, jobs may not inherit from it). |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 444 | |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 445 | A job with no parent is called a *base job* and may only be defined in |
| 446 | a :term:`config-project`. Every other job must have a parent, and so |
| 447 | ultimately, all jobs must have an inheritance path which terminates at |
| 448 | a base job. Each tenant has a default parent job which will be used |
| 449 | if no explicit parent is specified. |
| 450 | |
James E. Blair | c32a835 | 2017-10-11 16:27:50 -0700 | [diff] [blame] | 451 | Multiple job definitions with the same name are called variants. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 452 | These may have different selection criteria which indicate to Zuul |
| 453 | that, for instance, the job should behave differently on a different |
| 454 | git branch. Unlike inheritance, all job variants must be defined in |
Tobias Henkel | 8316762 | 2017-06-30 19:45:03 +0200 | [diff] [blame] | 455 | the same project. Some attributes of jobs marked :attr:`job.final` |
| 456 | may not be overidden |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 457 | |
| 458 | When Zuul decides to run a job, it performs a process known as |
| 459 | freezing the job. Because any number of job variants may be |
| 460 | applicable, Zuul collects all of the matching variants and applies |
| 461 | them in the order they appeared in the configuration. The resulting |
| 462 | frozen job is built from attributes gathered from all of the |
| 463 | matching variants. In this way, exactly what is run is dependent on |
| 464 | the pipeline, project, branch, and content of the item. |
| 465 | |
| 466 | In addition to the job's main playbook, each job may specify one or |
| 467 | more pre- and post-playbooks. These are run, in order, before and |
| 468 | after (respectively) the main playbook. They may be used to set up |
| 469 | and tear down resources needed by the main playbook. When combined |
| 470 | with inheritance, they provide powerful tools for job construction. A |
| 471 | job only has a single main playbook, and when inheriting from a |
| 472 | parent, the child's main playbook overrides (or replaces) the |
| 473 | parent's. However, the pre- and post-playbooks are appended and |
| 474 | prepended in a nesting fashion. So if a parent job and child job both |
| 475 | specified pre and post playbooks, the sequence of playbooks run would |
| 476 | be: |
| 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 | |
| 484 | Further inheritance would nest even deeper. |
| 485 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 486 | Here is an example of two job definitions: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 487 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 488 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 489 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 490 | - job: |
| 491 | name: base |
| 492 | pre-run: copy-git-repos |
| 493 | post-run: copy-logs |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 494 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 495 | - job: |
| 496 | name: run-tests |
| 497 | parent: base |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 498 | nodeset: |
| 499 | nodes: |
| 500 | - name: test-node |
| 501 | label: fedora |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 502 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 503 | .. attr:: job |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 504 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 505 | The following attributes are available on a job; all are optional |
| 506 | unless otherwise specified: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 507 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 508 | .. attr:: name |
| 509 | :required: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 510 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 511 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 514 | |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 515 | .. TODO: figure out how to link the parent default to tenant.default.parent |
| 516 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 517 | .. attr:: parent |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 518 | :default: Tenant default-parent |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 519 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 520 | Specifies a job to inherit from. The parent job can be defined |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 521 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 526 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 527 | .. attr:: description |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 528 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 529 | 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. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 533 | |
Tobias Henkel | 8316762 | 2017-06-30 19:45:03 +0200 | [diff] [blame] | 534 | .. 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 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 542 | .. attr:: success-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 543 | :default: SUCCESS |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 544 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 545 | Normally when a job succeeds, the string ``SUCCESS`` is reported |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 546 | as the result for the job. If set, this option may be used to |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 547 | supply a different string. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 548 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 549 | .. attr:: failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 550 | :default: FAILURE |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 551 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 552 | Normally when a job fails, the string ``FAILURE`` is reported as |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 553 | the result for the job. If set, this option may be used to |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 554 | supply a different string. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 555 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 556 | .. attr:: success-url |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 557 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 558 | When a job succeeds, this URL is reported along with the result. |
| 559 | If this value is not supplied, Zuul uses the content of the job |
| 560 | :ref:`return value <return_values>` **zuul.log_url**. This is |
| 561 | recommended as it allows the code which stores the URL to the |
| 562 | job artifacts to report exactly where they were stored. To |
| 563 | override this value, or if it is not set, supply an absolute URL |
| 564 | in this field. If a relative URL is supplied in this field, and |
| 565 | **zuul.log_url** is set, then the two will be combined to |
| 566 | produce the URL used for the report. This can be used to |
| 567 | specify that certain jobs should "deep link" into the stored job |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 568 | artifacts. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 569 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 570 | .. attr:: failure-url |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 571 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 572 | When a job fails, this URL is reported along with the result. |
| 573 | Otherwise behaves the same as **success-url**. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 574 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 575 | .. attr:: hold-following-changes |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 576 | :default: false |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 577 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 578 | In a dependent pipeline, this option may be used to indicate |
| 579 | that no jobs should start on any items which depend on the |
| 580 | current item until this job has completed successfully. This |
| 581 | may be used to conserve build resources, at the expense of |
| 582 | inhibiting the parallelization which speeds the processing of |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 583 | items in a dependent pipeline. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 584 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 585 | .. attr:: voting |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 586 | :default: true |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 587 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 588 | Indicates whether the result of this job should be used in |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 589 | determining the overall result of the item. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 590 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 591 | .. attr:: semaphore |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 592 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 593 | The name of a :ref:`semaphore` which should be acquired and |
| 594 | released when the job begins and ends. If the semaphore is at |
| 595 | maximum capacity, then Zuul will wait until it can be acquired |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 596 | before starting the job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 597 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 598 | .. attr:: tags |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 599 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 600 | Metadata about this job. Tags are units of information attached |
| 601 | to the job; they do not affect Zuul's behavior, but they can be |
| 602 | used within the job to characterize the job. For example, a job |
| 603 | which tests a certain subsystem could be tagged with the name of |
| 604 | that subsystem, and if the job's results are reported into a |
| 605 | database, then the results of all jobs affecting that subsystem |
| 606 | could be queried. This attribute is specified as a list of |
| 607 | strings, and when inheriting jobs or applying variants, tags |
| 608 | accumulate in a set, so the result is always a set of all the |
| 609 | tags from all the jobs and variants used in constructing the |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 610 | frozen job, with no duplication. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 611 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 612 | .. attr:: branches |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 613 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 614 | A regular expression (or list of regular expressions) which |
| 615 | describe on what branches a job should run (or in the case of |
| 616 | variants: to alter the behavior of a job for a certain branch). |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 617 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 618 | If there is no job definition for a given job which matches the |
| 619 | branch of an item, then that job is not run for the item. |
| 620 | Otherwise, all of the job variants which match that branch (and |
| 621 | any other selection criteria) are used when freezing the job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 622 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 623 | This example illustrates a job called *run-tests* which uses a |
| 624 | nodeset based on the current release of an operating system to |
| 625 | perform its tests, except when testing changes to the stable/2.0 |
| 626 | branch, in which case it uses an older release: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 627 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 628 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 629 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 630 | - job: |
| 631 | name: run-tests |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 632 | nodeset: current-release |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 633 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 634 | - job: |
| 635 | name: run-tests |
Andreas Jaeger | 438af86 | 2017-10-22 10:17:11 +0200 | [diff] [blame] | 636 | branches: stable/2.0 |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 637 | nodeset: old-release |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 638 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 639 | In some cases, Zuul uses an implied value for the branch |
| 640 | specifier if none is supplied: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 641 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 642 | * For a job definition in a :term:`config-project`, no implied |
| 643 | branch specifier is used. If no branch specifier appears, the |
| 644 | job applies to all branches. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 645 | |
James E. Blair | daaf326 | 2017-10-23 13:51:48 -0700 | [diff] [blame] | 646 | * In the case of an :term:`untrusted-project`, if the project |
| 647 | has only one branch, no implied branch specifier is applied to |
| 648 | :ref:`job` definitions. If the project has more than one |
| 649 | branch, the branch containing the job definition is used as an |
| 650 | implied branch specifier. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 651 | |
James E. Blair | e74f571 | 2017-09-29 15:14:31 -0700 | [diff] [blame] | 652 | * In the case of a job variant defined within a :ref:`project`, |
| 653 | if the project definition is in a :term:`config-project`, no |
| 654 | implied branch specifier is used. If it appears in an |
| 655 | :term:`untrusted-project`, with no branch specifier, the |
| 656 | branch containing the project definition is used as an implied |
| 657 | branch specifier. |
| 658 | |
| 659 | * In the case of a job variant defined within a |
| 660 | :ref:`project-template`, if no branch specifier appears, the |
James E. Blair | e36d1a3 | 2017-11-28 13:33:38 -0800 | [diff] [blame] | 661 | implied branch containing the project-template definition is |
| 662 | used as an implied branch specifier. This means that |
| 663 | definitions of the same project-template on different branches |
| 664 | may run different jobs. |
| 665 | |
| 666 | When that project-template is used by a :ref:`project` |
| 667 | definition within a :term:`untrusted-project`, the branch |
| 668 | containing that project definition is combined with the branch |
| 669 | specifier of the project-template. This means it is possible |
| 670 | for a project to use a template on one branch, but not on |
| 671 | another. |
James E. Blair | e74f571 | 2017-09-29 15:14:31 -0700 | [diff] [blame] | 672 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 673 | This allows for the very simple and expected workflow where if a |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 674 | project defines a job on the ``master`` branch with no branch |
| 675 | specifier, and then creates a new branch based on ``master``, |
| 676 | any changes to that job definition within the new branch only |
James E. Blair | daaf326 | 2017-10-23 13:51:48 -0700 | [diff] [blame] | 677 | affect that branch, and likewise, changes to the master branch |
| 678 | only affect it. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 679 | |
James E. Blair | 7edc25f | 2017-10-26 10:47:14 -0700 | [diff] [blame] | 680 | See :attr:`pragma.implied-branch-matchers` for how to override |
| 681 | this behavior on a per-file basis. |
| 682 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 683 | .. attr:: files |
Tobias Henkel | 2aade26 | 2017-07-12 16:09:06 +0200 | [diff] [blame] | 684 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 685 | This attribute indicates that the job should only run on changes |
| 686 | where the specified files are modified. This is a regular |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 687 | expression or list of regular expressions. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 688 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 689 | .. attr:: irrelevant-files |
James E. Blair | 74a82cf | 2017-07-12 17:23:08 -0700 | [diff] [blame] | 690 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 691 | This is a negative complement of **files**. It indicates that |
| 692 | the job should run unless *all* of the files changed match this |
| 693 | list. In other words, if the regular expression ``docs/.*`` is |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 694 | supplied, then this job will not run if the only files changed |
| 695 | are in the docs directory. A regular expression or list of |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 696 | regular expressions. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 697 | |
James E. Blair | e19e88a | 2017-08-09 15:14:29 -0700 | [diff] [blame] | 698 | .. attr:: secrets |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 699 | |
James E. Blair | e19e88a | 2017-08-09 15:14:29 -0700 | [diff] [blame] | 700 | A list of secrets which may be used by the job. A |
| 701 | :ref:`secret` is a named collection of private information |
| 702 | defined separately in the configuration. The secrets that |
| 703 | appear here must be defined in the same project as this job |
| 704 | definition. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 705 | |
Monty Taylor | aff8b40 | 2017-08-16 18:40:41 -0500 | [diff] [blame] | 706 | Each item in the list may may be supplied either as a string, |
| 707 | in which case it references the name of a :ref:`secret` definition, |
| 708 | or as a dict. If an element in this list is given as a dict, it |
| 709 | must have the following fields. |
| 710 | |
| 711 | .. attr:: name |
| 712 | |
| 713 | The name to use for the Ansible variable into which the secret |
| 714 | content will be placed. |
| 715 | |
| 716 | .. attr:: secret |
| 717 | |
| 718 | The name to use to find the secret's definition in the configuration. |
| 719 | |
| 720 | For example: |
| 721 | |
| 722 | .. code-block:: yaml |
| 723 | |
| 724 | - secret: |
| 725 | important-secret: |
| 726 | key: encrypted-secret-key-data |
| 727 | |
| 728 | - job: |
| 729 | name: amazing-job: |
| 730 | secrets: |
| 731 | - name: ssh_key |
| 732 | secret: important-secret |
| 733 | |
| 734 | will result in the following being passed as a variable to the playbooks |
| 735 | in ``amazing-job``: |
| 736 | |
| 737 | .. code-block:: yaml |
| 738 | |
| 739 | ssh_key: |
| 740 | key: descrypted-secret-key-data |
| 741 | |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 742 | .. attr:: nodeset |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 743 | |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 744 | The nodes which should be supplied to the job. This parameter |
| 745 | may be supplied either as a string, in which case it references |
| 746 | a :ref:`nodeset` definition which appears elsewhere in the |
| 747 | configuration, or a dictionary, in which case it is interpreted |
| 748 | in the same way as a Nodeset definition, though the ``name`` |
| 749 | attribute should be omitted (in essence, it is an anonymous |
| 750 | Nodeset definition unique to this job). See the :ref:`nodeset` |
| 751 | reference for the syntax to use in that case. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 752 | |
James E. Blair | 7e3e688 | 2017-09-20 15:47:13 -0700 | [diff] [blame] | 753 | If a job has an empty or no nodeset definition, it will still |
| 754 | run and may be able to perform actions on the Zuul executor. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 755 | |
James E. Blair | edff2c2 | 2017-10-30 14:04:48 -0700 | [diff] [blame] | 756 | .. attr:: override-checkout |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 757 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 758 | When Zuul runs jobs for a proposed change, it normally checks |
| 759 | out the branch associated with that change on every project |
| 760 | present in the job. If jobs are running on a ref (such as a |
| 761 | branch tip or tag), then that ref is normally checked out. This |
| 762 | attribute is used to override that behavior and indicate that |
| 763 | this job should, regardless of the branch for the queue item, |
James E. Blair | edff2c2 | 2017-10-30 14:04:48 -0700 | [diff] [blame] | 764 | use the indicated ref (i.e., branch or tag) instead. This can |
| 765 | be used, for example, to run a previous version of the software |
| 766 | (from a stable maintenance branch) under test even if the change |
| 767 | being tested applies to a different branch (this is only likely |
| 768 | to be useful if there is some cross-branch interaction with some |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 769 | component of the system being tested). See also the |
James E. Blair | edff2c2 | 2017-10-30 14:04:48 -0700 | [diff] [blame] | 770 | project-specific :attr:`job.required-projects.override-checkout` |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 771 | attribute to apply this behavior to a subset of a job's |
| 772 | projects. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 773 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 774 | .. attr:: timeout |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 775 | |
James E. Blair | b0c8e7e | 2017-08-28 09:19:49 -0700 | [diff] [blame] | 776 | The time in seconds that the job should be allowed to run before |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 777 | it is automatically aborted and failure is reported. If no |
| 778 | timeout is supplied, the job may run indefinitely. Supplying a |
| 779 | timeout is highly recommended. |
| 780 | |
| 781 | .. attr:: attempts |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 782 | :default: 3 |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 783 | |
| 784 | When Zuul encounters an error running a job's pre-run playbook, |
| 785 | Zuul will stop and restart the job. Errors during the main or |
| 786 | post-run -playbook phase of a job are not affected by this |
| 787 | parameter (they are reported immediately). This parameter |
| 788 | controls the number of attempts to make before an error is |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 789 | reported. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 790 | |
| 791 | .. attr:: pre-run |
| 792 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 793 | The name of a playbook or list of playbooks to run before the |
| 794 | main body of a job. The full path to the playbook in the repo |
| 795 | where the job is defined is expected. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 796 | |
| 797 | When a job inherits from a parent, the child's pre-run playbooks |
| 798 | are run after the parent's. See :ref:`job` for more |
| 799 | information. |
| 800 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 801 | .. warning:: |
| 802 | |
| 803 | If the path as specified does not exist, Zuul will try |
| 804 | appending the extensions ``.yaml`` and ``.yml``. This |
| 805 | behavior is deprecated and will be removed in the future all |
| 806 | playbook paths should include the file extension. |
| 807 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 808 | .. attr:: post-run |
| 809 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 810 | The name of a playbook or list of playbooks to run after the |
| 811 | main body of a job. The full path to the playbook in the repo |
| 812 | where the job is defined is expected. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 813 | |
| 814 | When a job inherits from a parent, the child's post-run |
| 815 | playbooks are run before the parent's. See :ref:`job` for more |
| 816 | information. |
| 817 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 818 | .. warning:: |
| 819 | |
| 820 | If the path as specified does not exist, Zuul will try |
| 821 | appending the extensions ``.yaml`` and ``.yml``. This |
| 822 | behavior is deprecated and will be removed in the future all |
| 823 | playbook paths should include the file extension. |
| 824 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 825 | .. attr:: run |
| 826 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 827 | The name of the main playbook for this job. If it is not |
| 828 | supplied, the parent's playbook will be used (and likewise up |
| 829 | the inheritance chain). The full path within the repo is |
| 830 | required. Example: |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 831 | |
| 832 | .. code-block:: yaml |
| 833 | |
James E. Blair | 6828656 | 2017-10-26 10:55:16 -0700 | [diff] [blame] | 834 | run: playbooks/job-playbook.yaml |
| 835 | |
| 836 | .. warning:: |
| 837 | |
| 838 | If the path as specified does not exist, Zuul will try |
| 839 | appending the extensions ``.yaml`` and ``.yml``. This |
| 840 | behavior is deprecated and will be removed in the future all |
| 841 | playbook paths should include the file extension. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 842 | |
| 843 | .. attr:: roles |
| 844 | |
| 845 | A list of Ansible roles to prepare for the job. Because a job |
| 846 | runs an Ansible playbook, any roles which are used by the job |
| 847 | must be prepared and installed by Zuul before the job begins. |
| 848 | This value is a list of dictionaries, each of which indicates |
| 849 | one of two types of roles: a Galaxy role, which is simply a role |
| 850 | that is installed from Ansible Galaxy, or a Zuul role, which is |
| 851 | a role provided by a project managed by Zuul. Zuul roles are |
| 852 | able to benefit from speculative merging and cross-project |
| 853 | dependencies when used by playbooks in untrusted projects. |
| 854 | Roles are added to the Ansible role path in the order they |
| 855 | appear on the job -- roles earlier in the list will take |
| 856 | precedence over those which follow. |
| 857 | |
| 858 | In the case of job inheritance or variance, the roles used for |
| 859 | each of the playbooks run by the job will be only those which |
| 860 | were defined along with that playbook. If a child job inherits |
| 861 | from a parent which defines a pre and post playbook, then the |
| 862 | pre and post playbooks it inherits from the parent job will run |
| 863 | only with the roles that were defined on the parent. If the |
| 864 | child adds its own pre and post playbooks, then any roles added |
| 865 | by the child will be available to the child's playbooks. This |
| 866 | is so that a job which inherits from a parent does not |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 867 | inadvertently alter the behavior of the parent's playbooks by |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 868 | the addition of conflicting roles. Roles added by a child will |
| 869 | appear before those it inherits from its parent. |
| 870 | |
| 871 | A project which supplies a role may be structured in one of two |
| 872 | configurations: a bare role (in which the role exists at the |
| 873 | root of the project), or a contained role (in which the role |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 874 | exists within the ``roles/`` directory of the project, perhaps |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 875 | along with other roles). In the case of a contained role, the |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 876 | ``roles/`` directory of the project is added to the role search |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 877 | path. In the case of a bare role, the project itself is added |
| 878 | to the role search path. In case the name of the project is not |
| 879 | the name under which the role should be installed (and therefore |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 880 | referenced from Ansible), the ``name`` attribute may be used to |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 881 | specify an alternate. |
| 882 | |
| 883 | A job automatically has the project in which it is defined added |
| 884 | to the roles path if that project appears to contain a role or |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 885 | ``roles/`` directory. By default, the project is added to the |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 886 | path under its own name, however, that may be changed by |
| 887 | explicitly listing the project in the roles list in the usual |
| 888 | way. |
| 889 | |
| 890 | .. note:: Galaxy roles are not yet implemented. |
| 891 | |
| 892 | .. attr:: galaxy |
| 893 | |
| 894 | The name of the role in Ansible Galaxy. If this attribute is |
| 895 | supplied, Zuul will search Ansible Galaxy for a role by this |
| 896 | name and install it. Mutually exclusive with ``zuul``; |
| 897 | either ``galaxy`` or ``zuul`` must be supplied. |
| 898 | |
| 899 | .. attr:: zuul |
| 900 | |
| 901 | The name of a Zuul project which supplies the role. Mutually |
| 902 | exclusive with ``galaxy``; either ``galaxy`` or ``zuul`` must |
| 903 | be supplied. |
| 904 | |
| 905 | .. attr:: name |
| 906 | |
| 907 | The installation name of the role. In the case of a bare |
| 908 | role, the role will be made available under this name. |
| 909 | Ignored in the case of a contained role. |
| 910 | |
| 911 | .. attr:: required-projects |
| 912 | |
| 913 | A list of other projects which are used by this job. Any Zuul |
| 914 | projects specified here will also be checked out by Zuul into |
| 915 | the working directory for the job. Speculative merging and |
| 916 | cross-repo dependencies will be honored. |
| 917 | |
| 918 | The format for this attribute is either a list of strings or |
| 919 | dictionaries. Strings are interpreted as project names, |
| 920 | dictionaries, if used, may have the following attributes: |
| 921 | |
| 922 | .. attr:: name |
| 923 | :required: |
| 924 | |
| 925 | The name of the required project. |
| 926 | |
James E. Blair | edff2c2 | 2017-10-30 14:04:48 -0700 | [diff] [blame] | 927 | .. attr:: override-checkout |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 928 | |
| 929 | When Zuul runs jobs for a proposed change, it normally checks |
| 930 | out the branch associated with that change on every project |
| 931 | present in the job. If jobs are running on a ref (such as a |
| 932 | branch tip or tag), then that ref is normally checked out. |
| 933 | This attribute is used to override that behavior and indicate |
| 934 | that this job should, regardless of the branch for the queue |
James E. Blair | edff2c2 | 2017-10-30 14:04:48 -0700 | [diff] [blame] | 935 | item, use the indicated ref (i.e., branch or tag) instead, |
| 936 | for only this project. See also the |
| 937 | :attr:`job.override-checkout` attribute to apply the same |
| 938 | behavior to all projects in a job. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 939 | |
| 940 | .. attr:: vars |
| 941 | |
| 942 | A dictionary of variables to supply to Ansible. When inheriting |
| 943 | from a job (or creating a variant of a job) vars are merged with |
| 944 | previous definitions. This means a variable definition with the |
| 945 | same name will override a previously defined variable, but new |
| 946 | variable names will be added to the set of defined variables. |
| 947 | |
| 948 | .. attr:: dependencies |
| 949 | |
| 950 | A list of other jobs upon which this job depends. Zuul will not |
| 951 | start executing this job until all of its dependencies have |
| 952 | completed successfully, and if one or more of them fail, this |
| 953 | job will not be run. |
| 954 | |
| 955 | .. attr:: allowed-projects |
| 956 | |
| 957 | A list of Zuul projects which may use this job. By default, a |
| 958 | job may be used by any other project known to Zuul, however, |
| 959 | some jobs use resources or perform actions which are not |
| 960 | appropriate for other projects. In these cases, a list of |
| 961 | projects which are allowed to use this job may be supplied. If |
| 962 | this list is not empty, then it must be an exhaustive list of |
| 963 | all projects permitted to use the job. The current project |
| 964 | (where the job is defined) is not automatically included, so if |
| 965 | it should be able to run this job, then it must be explicitly |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 966 | listed. By default, all projects may use the job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 967 | |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 968 | .. attr:: post-review |
| 969 | :default: false |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 970 | |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 971 | A boolean value which indicates whether this job may only be |
| 972 | used in pipelines where :attr:`pipeline.post-review` is |
Monty Taylor | a49b0ea | 2017-10-05 16:16:19 -0500 | [diff] [blame] | 973 | ``true``. This is automatically set to ``true`` if this job |
| 974 | uses a :ref:`secret` and is defined in a :term:`untrusted-project`. |
| 975 | It may be explicitly set to obtain the same behavior for jobs |
| 976 | defined in :term:`config projects <config-project>`. Once this |
| 977 | is set to ``true`` anywhere in the inheritance hierarchy for a job, |
| 978 | it will remain set for all child jobs and variants (it can not be |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 979 | set to ``false``). |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 980 | |
| 981 | .. _project: |
| 982 | |
| 983 | Project |
| 984 | ~~~~~~~ |
| 985 | |
| 986 | A project corresponds to a source code repository with which Zuul is |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 987 | configured to interact. The main responsibility of the project |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 988 | configuration item is to specify which jobs should run in which |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 989 | pipelines for a given project. Within each project definition, a |
| 990 | section for each :ref:`pipeline <pipeline>` may appear. This |
| 991 | project-pipeline definition is what determines how a project |
| 992 | participates in a pipeline. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 993 | |
James E. Blair | 0b7dc85 | 2017-10-10 13:41:03 -0700 | [diff] [blame] | 994 | Multiple project definitions may appear for the same project (for |
Monty Taylor | 4481232 | 2017-10-21 15:35:03 +0200 | [diff] [blame] | 995 | example, in a central :term:`config projects <config-project>` as well |
James E. Blair | 0b7dc85 | 2017-10-10 13:41:03 -0700 | [diff] [blame] | 996 | as in a repo's own ``.zuul.yaml``). In this case, all of the project |
| 997 | definitions are combined (the jobs listed in all of the definitions |
| 998 | will be run). |
| 999 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 1000 | Consider the following project definition:: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1001 | |
| 1002 | - project: |
| 1003 | name: yoyodyne |
| 1004 | check: |
| 1005 | jobs: |
| 1006 | - check-syntax |
| 1007 | - unit-tests |
| 1008 | gate: |
| 1009 | queue: integrated |
| 1010 | jobs: |
| 1011 | - unit-tests |
| 1012 | - integration-tests |
| 1013 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 1014 | The project has two project-pipeline stanzas, one for the ``check`` |
| 1015 | pipeline, and one for ``gate``. Each specifies which jobs should run |
| 1016 | when a change for that project enters the respective pipeline -- when |
| 1017 | a change enters ``check``, the ``check-syntax`` and ``unit-test`` jobs |
| 1018 | are run. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1019 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 1020 | Pipelines which use the dependent pipeline manager (e.g., the ``gate`` |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1021 | example shown earlier) maintain separate queues for groups of |
| 1022 | projects. When Zuul serializes a set of changes which represent |
| 1023 | future potential project states, it must know about all of the |
| 1024 | projects within Zuul which may have an effect on the outcome of the |
| 1025 | jobs it runs. If project *A* uses project *B* as a library, then Zuul |
| 1026 | must be told about that relationship so that it knows to serialize |
| 1027 | changes to A and B together, so that it does not merge a change to B |
| 1028 | while it is testing a change to A. |
| 1029 | |
| 1030 | Zuul could simply assume that all projects are related, or even infer |
| 1031 | relationships by which projects a job indicates it uses, however, in a |
| 1032 | large system that would become unwieldy very quickly, and |
| 1033 | unnecessarily delay changes to unrelated projects. To allow for |
| 1034 | flexibility in the construction of groups of related projects, the |
| 1035 | change queues used by dependent pipeline managers are specified |
| 1036 | manually. To group two or more related projects into a shared queue |
| 1037 | for a dependent pipeline, set the ``queue`` parameter to the same |
| 1038 | value for those projects. |
| 1039 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 1040 | The ``gate`` project-pipeline definition above specifies that this |
| 1041 | project participates in the ``integrated`` shared queue for that |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1042 | pipeline. |
| 1043 | |
James E. Blair | 9d4384d | 2017-08-01 15:54:50 -0700 | [diff] [blame] | 1044 | .. attr:: project |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1045 | |
James E. Blair | 0b7dc85 | 2017-10-10 13:41:03 -0700 | [diff] [blame] | 1046 | The following attributes may appear in a project: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1047 | |
James E. Blair | 9d4384d | 2017-08-01 15:54:50 -0700 | [diff] [blame] | 1048 | .. attr:: name |
| 1049 | :required: |
| 1050 | |
| 1051 | The name of the project. If Zuul is configured with two or more |
| 1052 | unique projects with the same name, the canonical hostname for |
| 1053 | the project should be included (e.g., `git.example.com/foo`). |
| 1054 | |
| 1055 | .. attr:: templates |
| 1056 | |
| 1057 | A list of :ref:`project-template` references; the |
| 1058 | project-pipeline definitions of each Project Template will be |
| 1059 | applied to this project. If more than one template includes |
| 1060 | jobs for a given pipeline, they will be combined, as will any |
| 1061 | jobs specified in project-pipeline definitions on the project |
| 1062 | itself. |
| 1063 | |
| 1064 | .. attr:: merge-mode |
| 1065 | :default: merge-resolve |
| 1066 | |
| 1067 | The merge mode which is used by Git for this project. Be sure |
| 1068 | this matches what the remote system which performs merges (i.e., |
| 1069 | Gerrit or GitHub). Must be one of the following values: |
| 1070 | |
| 1071 | .. value:: merge |
| 1072 | |
| 1073 | Uses the default git merge strategy (recursive). |
| 1074 | |
| 1075 | .. value:: merge-resolve |
| 1076 | |
| 1077 | Uses the resolve git merge strategy. This is a very |
| 1078 | conservative merge strategy which most closely matches the |
| 1079 | behavior of Gerrit. |
| 1080 | |
| 1081 | .. value:: cherry-pick |
| 1082 | |
| 1083 | Cherry-picks each change onto the branch rather than |
| 1084 | performing any merges. |
| 1085 | |
| 1086 | .. attr:: <pipeline> |
| 1087 | |
| 1088 | Each pipeline that the project participates in should have an |
| 1089 | entry in the project. The value for this key should be a |
| 1090 | dictionary with the following format: |
| 1091 | |
| 1092 | .. attr:: jobs |
| 1093 | :required: |
| 1094 | |
| 1095 | A list of jobs that should be run when items for this project |
| 1096 | are enqueued into the pipeline. Each item of this list may |
| 1097 | be a string, in which case it is treated as a job name, or it |
| 1098 | may be a dictionary, in which case it is treated as a job |
| 1099 | variant local to this project and pipeline. In that case, |
| 1100 | the format of the dictionary is the same as the top level |
| 1101 | :attr:`job` definition. Any attributes set on the job here |
| 1102 | will override previous versions of the job. |
| 1103 | |
| 1104 | .. attr:: queue |
| 1105 | |
| 1106 | If this pipeline is a :value:`dependent |
| 1107 | <pipeline.manager.dependent>` pipeline, this specifies the |
| 1108 | name of the shared queue this project is in. Any projects |
| 1109 | which interact with each other in tests should be part of the |
| 1110 | same shared queue in order to ensure that they don't merge |
| 1111 | changes which break the others. This is a free-form string; |
| 1112 | just set the same value for each group of projects. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1113 | |
| 1114 | .. _project-template: |
| 1115 | |
| 1116 | Project Template |
| 1117 | ~~~~~~~~~~~~~~~~ |
| 1118 | |
| 1119 | A Project Template defines one or more project-pipeline definitions |
| 1120 | which can be re-used by multiple projects. |
| 1121 | |
| 1122 | A Project Template uses the same syntax as a :ref:`project` |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1123 | definition, however, in the case of a template, the |
| 1124 | :attr:`project.name` attribute does not refer to the name of a |
| 1125 | project, but rather names the template so that it can be referenced in |
| 1126 | a `Project` definition. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1127 | |
| 1128 | .. _secret: |
| 1129 | |
| 1130 | Secret |
| 1131 | ~~~~~~ |
| 1132 | |
| 1133 | A Secret is a collection of private data for use by one or more jobs. |
| 1134 | In order to maintain the security of the data, the values are usually |
| 1135 | encrypted, however, data which are not sensitive may be provided |
| 1136 | unencrypted as well for convenience. |
| 1137 | |
| 1138 | A Secret may only be used by jobs defined within the same project. To |
James E. Blair | e19e88a | 2017-08-09 15:14:29 -0700 | [diff] [blame] | 1139 | use a secret, a :ref:`job` must specify the secret in |
| 1140 | :attr:`job.secrets`. Secrets are bound to the playbooks associated |
| 1141 | with the specific job definition where they were declared. Additional |
| 1142 | pre or post playbooks which appear in child jobs will not have access |
| 1143 | to the secrets, nor will playbooks which override the main playbook |
| 1144 | (if any) of the job which declared the secret. This protects against |
| 1145 | jobs in other repositories declaring a job with a secret as a parent |
| 1146 | and then exposing that secret. |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 1147 | |
| 1148 | It is possible to use secrets for jobs defined in :term:`config |
| 1149 | projects <config-project>` as well as :term:`untrusted projects |
| 1150 | <untrusted-project>`, however their use differs slightly. Because |
| 1151 | playbooks in a config project which use secrets run in the |
| 1152 | :term:`trusted execution context` where proposed changes are not used |
| 1153 | in executing jobs, it is safe for those secrets to be used in all |
| 1154 | types of pipelines. However, because playbooks defined in an |
| 1155 | untrusted project are run in the :term:`untrusted execution context` |
| 1156 | where proposed changes are used in job execution, it is dangerous to |
| 1157 | allow those secrets to be used in pipelines which are used to execute |
James E. Blair | 8eb564a | 2017-08-10 09:21:41 -0700 | [diff] [blame] | 1158 | proposed but unreviewed changes. By default, pipelines are considered |
| 1159 | `pre-review` and will refuse to run jobs which have playbooks that use |
| 1160 | secrets in the untrusted execution context to protect against someone |
| 1161 | proposing a change which exposes a secret. To permit this (for |
| 1162 | instance, in a pipeline which only runs after code review), the |
| 1163 | :attr:`pipeline.post-review` attribute may be explicitly set to |
| 1164 | ``true``. |
| 1165 | |
| 1166 | In some cases, it may be desirable to prevent a job which is defined |
| 1167 | in a config project from running in a pre-review pipeline (e.g., a job |
| 1168 | used to publish an artifact). In these cases, the |
| 1169 | :attr:`job.post-review` attribute may be explicitly set to ``true`` to |
| 1170 | indicate the job should only run in post-review pipelines. |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 1171 | |
| 1172 | If a job with secrets is unsafe to be used by other projects, the |
| 1173 | `allowed-projects` job attribute can be used to restrict the projects |
| 1174 | which can invoke that job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1175 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1176 | .. attr:: secret |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1177 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1178 | The following attributes must appear on a secret: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1179 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1180 | .. attr:: name |
| 1181 | :required: |
| 1182 | |
| 1183 | The name of the secret, used in a :ref:`Job` definition to |
| 1184 | request the secret. |
| 1185 | |
| 1186 | .. attr:: data |
| 1187 | :required: |
| 1188 | |
| 1189 | A dictionary which will be added to the Ansible variables |
| 1190 | available to the job. The values can either be plain text |
| 1191 | strings, or encrypted values. See :ref:`encryption` for more |
| 1192 | information. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1193 | |
| 1194 | .. _nodeset: |
| 1195 | |
| 1196 | Nodeset |
| 1197 | ~~~~~~~ |
| 1198 | |
| 1199 | A Nodeset is a named collection of nodes for use by a job. Jobs may |
| 1200 | specify what nodes they require individually, however, by defining |
| 1201 | groups of node types once and referring to them by name, job |
| 1202 | configuration may be simplified. |
| 1203 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1204 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1205 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1206 | - nodeset: |
| 1207 | name: nodeset1 |
| 1208 | nodes: |
| 1209 | - name: controller |
| 1210 | label: controller-label |
| 1211 | - name: compute1 |
| 1212 | label: compute-label |
| 1213 | - name: compute2 |
| 1214 | label: compute-label |
| 1215 | groups: |
| 1216 | - name: ceph-osd |
| 1217 | nodes: |
| 1218 | - controller |
| 1219 | - name: ceph-monitor |
| 1220 | nodes: |
| 1221 | - controller |
| 1222 | - compute1 |
| 1223 | - compute2 |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1224 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1225 | .. attr:: nodeset |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1226 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1227 | A Nodeset requires two attributes: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1228 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1229 | .. attr:: name |
| 1230 | :required: |
| 1231 | |
| 1232 | The name of the Nodeset, to be referenced by a :ref:`job`. |
| 1233 | |
| 1234 | .. attr:: nodes |
| 1235 | :required: |
| 1236 | |
| 1237 | A list of node definitions, each of which has the following format: |
| 1238 | |
| 1239 | .. attr:: name |
| 1240 | :required: |
| 1241 | |
| 1242 | The name of the node. This will appear in the Ansible inventory |
| 1243 | for the job. |
| 1244 | |
| 1245 | .. attr:: label |
| 1246 | :required: |
| 1247 | |
| 1248 | The Nodepool label for the node. Zuul will request a node with |
| 1249 | this label. |
| 1250 | |
| 1251 | .. attr:: groups |
| 1252 | |
| 1253 | Additional groups can be defined which are accessible from the ansible |
| 1254 | playbooks. |
| 1255 | |
| 1256 | .. attr:: name |
| 1257 | :required: |
| 1258 | |
| 1259 | The name of the group to be referenced by an ansible playbook. |
| 1260 | |
| 1261 | .. attr:: nodes |
| 1262 | :required: |
| 1263 | |
| 1264 | The nodes that shall be part of the group. This is specified as a list |
| 1265 | of strings. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1266 | |
| 1267 | .. _semaphore: |
| 1268 | |
| 1269 | Semaphore |
| 1270 | ~~~~~~~~~ |
| 1271 | |
| 1272 | Semaphores can be used to restrict the number of certain jobs which |
| 1273 | are running at the same time. This may be useful for jobs which |
| 1274 | access shared or limited resources. A semaphore has a value which |
| 1275 | represents the maximum number of jobs which use that semaphore at the |
| 1276 | same time. |
| 1277 | |
| 1278 | Semaphores are never subject to dynamic reconfiguration. If the value |
| 1279 | of a semaphore is changed, it will take effect only when the change |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1280 | where it is updated is merged. An example follows: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1281 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1282 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1283 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1284 | - semaphore: |
| 1285 | name: semaphore-foo |
| 1286 | max: 5 |
| 1287 | - semaphore: |
| 1288 | name: semaphore-bar |
| 1289 | max: 3 |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1290 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1291 | .. attr:: semaphore |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1292 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1293 | The following attributes are available: |
| 1294 | |
| 1295 | .. attr:: name |
| 1296 | :required: |
| 1297 | |
| 1298 | The name of the semaphore, referenced by jobs. |
| 1299 | |
| 1300 | .. attr:: max |
| 1301 | :default: 1 |
| 1302 | |
| 1303 | The maximum number of running jobs which can use this semaphore. |
James E. Blair | 7edc25f | 2017-10-26 10:47:14 -0700 | [diff] [blame] | 1304 | |
| 1305 | .. _pragma: |
| 1306 | |
| 1307 | Pragma |
| 1308 | ~~~~~~ |
| 1309 | |
| 1310 | The `pragma` item does not behave like the others. It can not be |
| 1311 | included or excluded from configuration loading by the administrator, |
| 1312 | and does not form part of the final configuration itself. It is used |
| 1313 | to alter how the configuration is processed while loading. |
| 1314 | |
| 1315 | A pragma item only affects the current file. The same file in another |
| 1316 | branch of the same project will not be affected, nor any other files |
| 1317 | or any other projects. The effect is global within that file -- |
| 1318 | pragma directives may not be set and then unset within the same file. |
| 1319 | |
| 1320 | .. code-block:: yaml |
| 1321 | |
| 1322 | - pragma: |
| 1323 | implied-branch-matchers: False |
| 1324 | |
| 1325 | .. attr:: pragma |
| 1326 | |
| 1327 | The pragma item currently only supports one attribute: |
| 1328 | |
| 1329 | .. attr:: implied-branch-matchers |
| 1330 | |
| 1331 | This is a boolean, which, if set, may be used to enable |
| 1332 | (``True``) or disable (``False``) the addition of implied branch |
| 1333 | matchers to job definitions. Normally Zuul decides whether to |
| 1334 | add these based on heuristics described in :attr:`job.branches`. |
| 1335 | This attribute overrides that behavior. |
| 1336 | |
| 1337 | This can be useful if a project has multiple branches, yet the |
| 1338 | jobs defined in the master branch should apply to all branches. |
| 1339 | |
| 1340 | Note that if a job contains an explicit branch matcher, it will |
| 1341 | be used regardless of the value supplied here. |