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 | |
| 60 | Configuration Items |
| 61 | ------------------- |
| 62 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 63 | The ``zuul.yaml`` and ``.zuul.yaml`` configuration files are |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 64 | YAML-formatted and are structured as a series of items, each of which |
| 65 | is described below. |
| 66 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 67 | In the case of a ``zuul.d`` directory, Zuul recurses the directory and |
| 68 | extends the configuration using all the .yaml files in the sorted path |
| 69 | order. For example, to keep job's variants in a separate file, it |
| 70 | needs to be loaded after the main entries, for example using number |
| 71 | prefixes in file's names:: |
Tristan Cacqueray | 4a01583 | 2017-07-11 05:18:14 +0000 | [diff] [blame] | 72 | |
| 73 | * zuul.d/pipelines.yaml |
| 74 | * zuul.d/projects.yaml |
| 75 | * zuul.d/01_jobs.yaml |
| 76 | * zuul.d/02_jobs-variants.yaml |
| 77 | |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 78 | .. _pipeline: |
| 79 | |
| 80 | Pipeline |
| 81 | ~~~~~~~~ |
| 82 | |
| 83 | A pipeline describes a workflow operation in Zuul. It associates jobs |
| 84 | for a given project with triggering and reporting events. |
| 85 | |
| 86 | Its flexible configuration allows for characterizing any number of |
| 87 | workflows, and by specifying each as a named configuration, makes it |
| 88 | easy to apply similar workflow operations to projects or groups of |
| 89 | projects. |
| 90 | |
| 91 | 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] | 92 | project gating. To do so, one can create a :term:`gate` pipeline |
| 93 | 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] | 94 | reviewer) occurs, the corresponding change or pull request should be |
| 95 | enqueued into the pipeline. When that happens, the jobs which have |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 96 | been configured to run for that project in the gate pipeline are run, |
| 97 | 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] | 98 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 99 | Pipeline configuration items may only appear in :term:`config-projects |
| 100 | <config-project>`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 101 | |
| 102 | Generally, a Zuul administrator would define a small number of |
| 103 | pipelines which represent the workflow processes used in their |
| 104 | environment. Each project can then be added to the available |
| 105 | pipelines as appropriate. |
| 106 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 107 | 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] | 108 | patchset is created in Gerrit. If the associated jobs all report |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 109 | success, the pipeline reports back to Gerrit with ``Verified`` vote of |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 110 | +1, or if at least one of them fails, a -1: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 111 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 112 | .. code-block:: yaml |
| 113 | |
| 114 | - pipeline: |
| 115 | name: check |
| 116 | manager: independent |
| 117 | trigger: |
| 118 | my_gerrit: |
| 119 | - event: patchset-created |
| 120 | success: |
| 121 | my_gerrit: |
| 122 | Verified: 1 |
| 123 | failure: |
| 124 | my_gerrit |
| 125 | Verified: -1 |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 126 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 127 | .. TODO: See TODO for more annotated examples of common pipeline configurations. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 128 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 129 | .. attr:: pipeline |
James E. Blair | 7145c58 | 2017-07-26 13:30:39 -0700 | [diff] [blame] | 130 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 131 | The attributes available on a pipeline are as follows (all are |
| 132 | optional unless otherwise specified): |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 133 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 134 | .. attr:: name |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 135 | :required: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 136 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 137 | This is used later in the project definition to indicate what jobs |
| 138 | should be run for events in the pipeline. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 139 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 140 | .. attr:: manager |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 141 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 142 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 143 | There are currently two schemes for managing pipelines: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 144 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 145 | .. value:: independent |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 146 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 147 | Every event in this pipeline should be treated as independent |
| 148 | of other events in the pipeline. This is appropriate when |
| 149 | the order of events in the pipeline doesn't matter because |
| 150 | the results of the actions this pipeline performs can not |
| 151 | affect other events in the pipeline. For example, when a |
| 152 | change is first uploaded for review, you may want to run |
| 153 | tests on that change to provide early feedback to reviewers. |
| 154 | At the end of the tests, the change is not going to be |
| 155 | merged, so it is safe to run these tests in parallel without |
| 156 | regard to any other changes in the pipeline. They are |
| 157 | independent. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 158 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 159 | Another type of pipeline that is independent is a post-merge |
| 160 | pipeline. In that case, the changes have already merged, so |
| 161 | the results can not affect any other events in the pipeline. |
James E. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 162 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 163 | .. value:: dependent |
James E. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 164 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 165 | The dependent pipeline manager is designed for gating. It |
| 166 | ensures that every change is tested exactly as it is going to |
| 167 | be merged into the repository. An ideal gating system would |
| 168 | test one change at a time, applied to the tip of the |
| 169 | repository, and only if that change passed tests would it be |
| 170 | merged. Then the next change in line would be tested the |
| 171 | same way. In order to achieve parallel testing of changes, |
| 172 | the dependent pipeline manager performs speculative execution |
| 173 | on changes. It orders changes based on their entry into the |
| 174 | pipeline. It begins testing all changes in parallel, |
| 175 | assuming that each change ahead in the pipeline will pass its |
| 176 | tests. If they all succeed, all the changes can be tested |
| 177 | and merged in parallel. If a change near the front of the |
| 178 | pipeline fails its tests, each change behind it ignores |
| 179 | whatever tests have been completed and are tested again |
| 180 | without the change in front. This way gate tests may run in |
| 181 | parallel but still be tested correctly, exactly as they will |
| 182 | appear in the repository when merged. |
James E. Blair | 1761e86 | 2017-07-25 16:15:47 -0700 | [diff] [blame] | 183 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 184 | For more detail on the theory and operation of Zuul's |
| 185 | dependent pipeline manager, see: :doc:`gating`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 186 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 187 | .. attr:: allow-secrets |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 188 | :default: false |
James E. Blair | f17aa9c | 2017-07-05 13:21:23 -0700 | [diff] [blame] | 189 | |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 190 | This is a boolean which can be used to prevent jobs which use |
| 191 | secrets in the untrusted security context from running in this |
| 192 | pipeline. Some pipelines run on proposed changes and therefore |
| 193 | execute code which has not yet been reviewed. In such a case, |
| 194 | allowing a job to use a secret could result in that secret being |
| 195 | exposed. The default is ``false``, meaning that in order to run |
| 196 | jobs which use secrets in the untrusted security context, this |
| 197 | must be explicitly enabled on each Pipeline where that is safe. |
James E. Blair | f17aa9c | 2017-07-05 13:21:23 -0700 | [diff] [blame] | 198 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 199 | For more information, see :ref:`secret`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 200 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 201 | .. attr:: description |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 202 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 203 | This field may be used to provide a textual description of the |
| 204 | pipeline. It may appear in the status page or in documentation. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 205 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 206 | .. attr:: success-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 207 | :default: Build successful. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 208 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 209 | The introductory text in reports when all the voting jobs are |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 210 | successful. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 211 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 212 | .. attr:: failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 213 | :default: Build failed. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 214 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 215 | The introductory text in reports when at least one voting job |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 216 | fails. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 217 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 218 | .. attr:: merge-failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 219 | :default: Merge failed. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 220 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 221 | The introductory text in the message reported when a change |
| 222 | fails to merge with the current state of the repository. |
| 223 | Defaults to "Merge failed." |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 224 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 225 | .. attr:: footer-message |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 226 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 227 | Supplies additional information after test results. Useful for |
| 228 | adding information about the CI system such as debugging and |
| 229 | contact details. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 230 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 231 | .. attr:: trigger |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 232 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 233 | At least one trigger source must be supplied for each pipeline. |
| 234 | Triggers are not exclusive -- matching events may be placed in |
| 235 | multiple pipelines, and they will behave independently in each |
| 236 | of the pipelines they match. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 237 | |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 238 | Triggers are loaded from their connection name. The driver type |
| 239 | of the connection will dictate which options are available. See |
| 240 | :ref:`drivers`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 241 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 242 | .. attr:: require |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 243 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 244 | If this section is present, it establishes prerequisites for |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 245 | any kind of item entering the Pipeline. Regardless of how the |
| 246 | item is to be enqueued (via any trigger or automatic dependency |
| 247 | resolution), the conditions specified here must be met or the |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 248 | item will not be enqueued. These requirements may vary |
| 249 | depending on the source of the item being enqueued. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 250 | |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 251 | Requirements are loaded from their connection name. The driver |
| 252 | type of the connection will dictate which options are available. |
| 253 | See :ref:`drivers`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 254 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 255 | .. attr:: reject |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 256 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 257 | If this section is present, it establishes prerequisites that |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 258 | 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] | 259 | negative version of :attr:`pipeline.require`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 260 | |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 261 | Requirements are loaded from their connection name. The driver |
| 262 | type of the connection will dictate which options are available. |
| 263 | See :ref:`drivers`. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 264 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 265 | .. attr:: dequeue-on-new-patchset |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 266 | :default: true |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 267 | |
| 268 | Normally, if a new patchset is uploaded to a change that is in a |
| 269 | pipeline, the existing entry in the pipeline will be removed |
| 270 | (with jobs canceled and any dependent changes that can no longer |
| 271 | merge as well. To suppress this behavior (and allow jobs to |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 272 | continue running), set this to ``false``. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 273 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 274 | .. attr:: ignore-dependencies |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 275 | :default: false |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 276 | |
| 277 | In any kind of pipeline (dependent or independent), Zuul will |
| 278 | attempt to enqueue all dependencies ahead of the current change |
| 279 | so that they are tested together (independent pipelines report |
| 280 | the results of each change regardless of the results of changes |
| 281 | ahead). To ignore dependencies completely in an independent |
| 282 | pipeline, set this to ``true``. This option is ignored by |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 283 | dependent pipelines. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 284 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 285 | .. attr:: precedence |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 286 | :default: normal |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 287 | |
| 288 | Indicates how the build scheduler should prioritize jobs for |
| 289 | different pipelines. Each pipeline may have one precedence, |
| 290 | jobs for pipelines with a higher precedence will be run before |
| 291 | ones with lower. The value should be one of ``high``, |
| 292 | ``normal``, or ``low``. Default: ``normal``. |
| 293 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 294 | .. _reporters: |
| 295 | |
| 296 | The following options configure :term:`reporters <reporter>`. |
| 297 | Reporters are complementary to triggers; where a trigger is an |
| 298 | event on a connection which causes Zuul to enqueue an item, a |
| 299 | reporter is the action performed on a connection when an item is |
| 300 | dequeued after its jobs complete. The actual syntax for a reporter |
| 301 | is defined by the driver which implements it. See :ref:`drivers` |
| 302 | for more information. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 303 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 304 | .. attr:: success |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 305 | |
| 306 | Describes where Zuul should report to if all the jobs complete |
| 307 | successfully. This section is optional; if it is omitted, Zuul |
| 308 | 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] | 309 | all. If the section is present, the listed :term:`reporters |
| 310 | <reporter>` will be asked to report on the jobs. The reporters |
| 311 | are listed by their connection name. The options available |
| 312 | depend on the driver for the supplied connection. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 313 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 314 | .. attr:: failure |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 315 | |
| 316 | These reporters describe what Zuul should do if at least one job |
| 317 | fails. |
| 318 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 319 | .. attr:: merge-failure |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 320 | |
| 321 | These reporters describe what Zuul should do if it is unable to |
| 322 | merge in the patchset. If no merge-failure reporters are listed |
| 323 | then the ``failure`` reporters will be used to notify of |
| 324 | unsuccessful merges. |
| 325 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 326 | .. attr:: start |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 327 | |
| 328 | These reporters describe what Zuul should do when a change is |
| 329 | added to the pipeline. This can be used, for example, to reset |
| 330 | a previously reported result. |
| 331 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 332 | .. attr:: disabled |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 333 | |
| 334 | These reporters describe what Zuul should do when a pipeline is |
| 335 | disabled. See ``disable-after-consecutive-failures``. |
| 336 | |
| 337 | The following options can be used to alter Zuul's behavior to |
| 338 | mitigate situations in which jobs are failing frequently (perhaps |
| 339 | due to a problem with an external dependency, or unusually high |
| 340 | non-deterministic test failures). |
| 341 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 342 | .. attr:: disable-after-consecutive-failures |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 343 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 344 | 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] | 345 | 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] | 346 | will stop reporting to any of the **success**, **failure** or |
| 347 | **merge-failure** reporters and instead only report to the |
| 348 | **disabled** reporters. (No **start** reports are made when a |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 349 | pipeline is disabled). |
| 350 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 351 | .. attr:: window |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 352 | :default: 20 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 353 | |
| 354 | Dependent pipeline managers only. Zuul can rate limit dependent |
| 355 | pipelines in a manner similar to TCP flow control. Jobs are |
| 356 | only started for items in the queue if they are within the |
| 357 | actionable window for the pipeline. The initial length of this |
| 358 | window is configurable with this value. The value given should |
| 359 | be a positive integer value. A value of ``0`` disables rate |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 360 | limiting on the :value:`dependent pipeline manager |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 361 | <pipeline.manager.dependent>`. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 362 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 363 | .. attr:: window-floor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 364 | :default: 3 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 365 | |
| 366 | Dependent pipeline managers only. This is the minimum value for |
| 367 | the window described above. Should be a positive non zero |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 368 | integer value. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 369 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 370 | .. attr:: window-increase-type |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 371 | :default: linear |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 372 | |
| 373 | Dependent pipeline managers only. This value describes how the |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 374 | window should grow when changes are successfully merged by zuul. |
| 375 | |
| 376 | .. value:: linear |
| 377 | |
| 378 | Indicates that **window-increase-factor** should be added to |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 379 | the previous window value. |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 380 | |
| 381 | .. value:: exponential |
| 382 | |
| 383 | Indicates that **window-increase-factor** should be |
| 384 | multiplied against the previous window value and the result |
| 385 | will become the window size. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 386 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 387 | .. attr:: window-increase-factor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 388 | :default: 1 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 389 | |
| 390 | Dependent pipeline managers only. The value to be added or |
| 391 | multiplied against the previous window value to determine the |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 392 | new window after successful change merges. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 393 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 394 | .. attr:: window-decrease-type |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 395 | :default: exponential |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 396 | |
| 397 | Dependent pipeline managers only. This value describes how the |
| 398 | 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] | 399 | Zuul. |
| 400 | |
| 401 | .. value:: linear |
| 402 | |
| 403 | Indicates that **window-decrease-factor** should be |
| 404 | subtracted from the previous window value. |
| 405 | |
| 406 | .. value:: exponential |
| 407 | |
| 408 | Indicates that **window-decrease-factor** should be divided |
| 409 | against the previous window value and the result will become |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 410 | the window size. |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 411 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 412 | .. attr:: window-decrease-factor |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 413 | :default: 2 |
James E. Blair | 9fd98ab | 2017-07-26 14:15:26 -0700 | [diff] [blame] | 414 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 415 | :value:`Dependent pipeline managers |
| 416 | <pipeline.manager.dependent>` only. The value to be subtracted |
| 417 | or divided against the previous window value to determine the |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 418 | new window after unsuccessful change merges. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 419 | |
| 420 | |
| 421 | .. _job: |
| 422 | |
| 423 | Job |
| 424 | ~~~ |
| 425 | |
| 426 | A job is a unit of work performed by Zuul on an item enqueued into a |
| 427 | pipeline. Items may run any number of jobs (which may depend on each |
| 428 | other). Each job is an invocation of an Ansible playbook with a |
| 429 | specific inventory of hosts. The actual tasks that are run by the job |
| 430 | appear in the playbook for that job while the attributes that appear in the |
| 431 | Zuul configuration specify information about when, where, and how the |
| 432 | job should be run. |
| 433 | |
| 434 | Jobs in Zuul support inheritance. Any job may specify a single parent |
| 435 | job, and any attributes not set on the child job are collected from |
| 436 | the parent job. In this way, a configuration structure may be built |
| 437 | starting with very basic jobs which describe characteristics that all |
| 438 | jobs on the system should have, progressing through stages of |
| 439 | specialization before arriving at a particular job. A job may inherit |
| 440 | from any other job in any project (however, if the other job is marked |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 441 | as ``final``, some attributes may not be overidden). |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 442 | |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 443 | A job with no parent is called a *base job* and may only be defined in |
| 444 | a :term:`config-project`. Every other job must have a parent, and so |
| 445 | ultimately, all jobs must have an inheritance path which terminates at |
| 446 | a base job. Each tenant has a default parent job which will be used |
| 447 | if no explicit parent is specified. |
| 448 | |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 449 | Jobs also support a concept called variance. The first time a job |
| 450 | definition appears is called the reference definition of the job. |
| 451 | Subsequent job definitions with the same name are called variants. |
| 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 |
| 455 | the same project. |
| 456 | |
| 457 | When Zuul decides to run a job, it performs a process known as |
| 458 | freezing the job. Because any number of job variants may be |
| 459 | applicable, Zuul collects all of the matching variants and applies |
| 460 | them in the order they appeared in the configuration. The resulting |
| 461 | frozen job is built from attributes gathered from all of the |
| 462 | matching variants. In this way, exactly what is run is dependent on |
| 463 | the pipeline, project, branch, and content of the item. |
| 464 | |
| 465 | In addition to the job's main playbook, each job may specify one or |
| 466 | more pre- and post-playbooks. These are run, in order, before and |
| 467 | after (respectively) the main playbook. They may be used to set up |
| 468 | and tear down resources needed by the main playbook. When combined |
| 469 | with inheritance, they provide powerful tools for job construction. A |
| 470 | job only has a single main playbook, and when inheriting from a |
| 471 | parent, the child's main playbook overrides (or replaces) the |
| 472 | parent's. However, the pre- and post-playbooks are appended and |
| 473 | prepended in a nesting fashion. So if a parent job and child job both |
| 474 | specified pre and post playbooks, the sequence of playbooks run would |
| 475 | be: |
| 476 | |
| 477 | * parent pre-run playbook |
| 478 | * child pre-run playbook |
| 479 | * child playbook |
| 480 | * child post-run playbook |
| 481 | * parent post-run playbook |
| 482 | |
| 483 | Further inheritance would nest even deeper. |
| 484 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 485 | Here is an example of two job definitions: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 486 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 487 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 488 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 489 | - job: |
| 490 | name: base |
| 491 | pre-run: copy-git-repos |
| 492 | post-run: copy-logs |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 493 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 494 | - job: |
| 495 | name: run-tests |
| 496 | parent: base |
| 497 | nodes: |
| 498 | - name: test-node |
David Shrewsbury | c50cb57 | 2017-08-04 11:55:01 -0400 | [diff] [blame] | 499 | label: fedora |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 500 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 501 | .. attr:: job |
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 | The following attributes are available on a job; all are optional |
| 504 | unless otherwise specified: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 505 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 506 | .. attr:: name |
| 507 | :required: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 508 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 509 | The name of the job. By default, Zuul looks for a playbook with |
| 510 | this name to use as the main playbook for the job. This name is |
| 511 | also referenced later in a project pipeline configuration. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 512 | |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 513 | .. TODO: figure out how to link the parent default to tenant.default.parent |
| 514 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 515 | .. attr:: parent |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 516 | :default: Tenant default-parent |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 517 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 518 | 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] | 519 | in this or any other project. Any attributes not specified on a |
| 520 | job will be collected from its parent. If no value is supplied |
| 521 | here, the job specified by :attr:`tenant.default-parent` will be |
| 522 | used. If **parent** is set to ``null`` (which is only valid in |
| 523 | a :term:`config-project`), this is a :term:`base job`. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 524 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 525 | .. attr:: description |
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 | A textual description of the job. Not currently used directly |
| 528 | by Zuul, but it is used by the zuul-sphinx extension to Sphinx |
| 529 | to auto-document Zuul jobs (in which case it is interpreted as |
| 530 | ReStructuredText. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 531 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 532 | .. attr:: success-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 533 | :default: SUCCESS |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 534 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 535 | Normally when a job succeeds, the string ``SUCCESS`` is reported |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 536 | 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] | 537 | supply a different string. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 538 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 539 | .. attr:: failure-message |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 540 | :default: FAILURE |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 541 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 542 | Normally when a job fails, the string ``FAILURE`` is reported as |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 543 | 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] | 544 | supply a different string. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 545 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 546 | .. attr:: success-url |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 547 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 548 | When a job succeeds, this URL is reported along with the result. |
| 549 | If this value is not supplied, Zuul uses the content of the job |
| 550 | :ref:`return value <return_values>` **zuul.log_url**. This is |
| 551 | recommended as it allows the code which stores the URL to the |
| 552 | job artifacts to report exactly where they were stored. To |
| 553 | override this value, or if it is not set, supply an absolute URL |
| 554 | in this field. If a relative URL is supplied in this field, and |
| 555 | **zuul.log_url** is set, then the two will be combined to |
| 556 | produce the URL used for the report. This can be used to |
| 557 | specify that certain jobs should "deep link" into the stored job |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 558 | artifacts. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 559 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 560 | .. attr:: failure-url |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 561 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 562 | When a job fails, this URL is reported along with the result. |
| 563 | Otherwise behaves the same as **success-url**. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 564 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 565 | .. attr:: hold-following-changes |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 566 | :default: false |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 567 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 568 | In a dependent pipeline, this option may be used to indicate |
| 569 | that no jobs should start on any items which depend on the |
| 570 | current item until this job has completed successfully. This |
| 571 | may be used to conserve build resources, at the expense of |
| 572 | inhibiting the parallelization which speeds the processing of |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 573 | items in a dependent pipeline. |
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:: voting |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 576 | :default: true |
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 | Indicates whether the result of this job should be used in |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 579 | determining the overall result of the item. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 580 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 581 | .. attr:: semaphore |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 582 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 583 | The name of a :ref:`semaphore` which should be acquired and |
| 584 | released when the job begins and ends. If the semaphore is at |
| 585 | maximum capacity, then Zuul will wait until it can be acquired |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 586 | before starting the job. |
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 | .. attr:: tags |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 589 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 590 | Metadata about this job. Tags are units of information attached |
| 591 | to the job; they do not affect Zuul's behavior, but they can be |
| 592 | used within the job to characterize the job. For example, a job |
| 593 | which tests a certain subsystem could be tagged with the name of |
| 594 | that subsystem, and if the job's results are reported into a |
| 595 | database, then the results of all jobs affecting that subsystem |
| 596 | could be queried. This attribute is specified as a list of |
| 597 | strings, and when inheriting jobs or applying variants, tags |
| 598 | accumulate in a set, so the result is always a set of all the |
| 599 | tags from all the jobs and variants used in constructing the |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 600 | frozen job, with no duplication. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 601 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 602 | .. attr:: branches |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 603 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 604 | A regular expression (or list of regular expressions) which |
| 605 | describe on what branches a job should run (or in the case of |
| 606 | 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] | 607 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 608 | If there is no job definition for a given job which matches the |
| 609 | branch of an item, then that job is not run for the item. |
| 610 | Otherwise, all of the job variants which match that branch (and |
| 611 | any other selection criteria) are used when freezing the job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 612 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 613 | This example illustrates a job called *run-tests* which uses a |
| 614 | nodeset based on the current release of an operating system to |
| 615 | perform its tests, except when testing changes to the stable/2.0 |
| 616 | branch, in which case it uses an older release: |
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 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 619 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 620 | - job: |
| 621 | name: run-tests |
| 622 | nodes: current-release |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 623 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 624 | - job: |
| 625 | name: run-tests |
| 626 | branch: stable/2.0 |
| 627 | nodes: old-release |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 628 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 629 | In some cases, Zuul uses an implied value for the branch |
| 630 | specifier if none is supplied: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 631 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 632 | * For a job definition in a :term:`config-project`, no implied |
| 633 | branch specifier is used. If no branch specifier appears, the |
| 634 | job applies to all branches. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 635 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 636 | * In the case of an :term:`untrusted-project`, no implied branch |
| 637 | specifier is applied to the reference definition of a job. |
| 638 | That is to say, that if the first appearance of the job |
| 639 | definition appears without a branch specifier, then it will |
| 640 | apply to all branches. Note that when collecting its |
| 641 | configuration, Zuul reads the ``master`` branch of a given |
| 642 | project first, then other branches in alphabetical order. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 643 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 644 | * Any further job variants other than the reference definition |
| 645 | in an untrusted-project will, if they do not have a branch |
| 646 | specifier, will have an implied branch specifier for the |
| 647 | current branch applied. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 648 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 649 | 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] | 650 | project defines a job on the ``master`` branch with no branch |
| 651 | specifier, and then creates a new branch based on ``master``, |
| 652 | any changes to that job definition within the new branch only |
| 653 | affect that branch. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 654 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 655 | .. attr:: files |
Tobias Henkel | 2aade26 | 2017-07-12 16:09:06 +0200 | [diff] [blame] | 656 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 657 | This attribute indicates that the job should only run on changes |
| 658 | where the specified files are modified. This is a regular |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 659 | expression or list of regular expressions. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 660 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 661 | .. attr:: irrelevant-files |
James E. Blair | 74a82cf | 2017-07-12 17:23:08 -0700 | [diff] [blame] | 662 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 663 | This is a negative complement of **files**. It indicates that |
| 664 | the job should run unless *all* of the files changed match this |
| 665 | list. In other words, if the regular expression ``docs/.*`` is |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 666 | supplied, then this job will not run if the only files changed |
| 667 | are in the docs directory. A regular expression or list of |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 668 | regular expressions. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 669 | |
James E. Blair | e19e88a | 2017-08-09 15:14:29 -0700 | [diff] [blame^] | 670 | .. attr:: secrets |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 671 | |
James E. Blair | e19e88a | 2017-08-09 15:14:29 -0700 | [diff] [blame^] | 672 | A list of secrets which may be used by the job. A |
| 673 | :ref:`secret` is a named collection of private information |
| 674 | defined separately in the configuration. The secrets that |
| 675 | appear here must be defined in the same project as this job |
| 676 | definition. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 677 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 678 | .. attr:: nodes |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 679 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 680 | A list of nodes which should be supplied to the job. This |
| 681 | parameter may be supplied either as a string, in which case it |
| 682 | references a :ref:`nodeset` definition which appears elsewhere |
| 683 | in the configuration, or a list, in which case it is interpreted |
| 684 | in the same way as a Nodeset definition (in essence, it is an |
| 685 | anonymous Node definition unique to this job). See the |
| 686 | :ref:`nodeset` reference for the syntax to use in that case. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 687 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 688 | If a job has an empty or no node definition, it will still run |
| 689 | and may be able to perform actions on the Zuul executor. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 690 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 691 | .. attr:: override-branch |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 692 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 693 | When Zuul runs jobs for a proposed change, it normally checks |
| 694 | out the branch associated with that change on every project |
| 695 | present in the job. If jobs are running on a ref (such as a |
| 696 | branch tip or tag), then that ref is normally checked out. This |
| 697 | attribute is used to override that behavior and indicate that |
| 698 | this job should, regardless of the branch for the queue item, |
| 699 | use the indicated branch instead. This can be used, for |
| 700 | example, to run a previous version of the software (from a |
| 701 | stable maintenance branch) under test even if the change being |
| 702 | tested applies to a different branch (this is only likely to be |
| 703 | useful if there is some cross-branch interaction with some |
| 704 | component of the system being tested). See also the |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 705 | project-specific :attr:`job.required-projects.override-branch` |
| 706 | attribute to apply this behavior to a subset of a job's |
| 707 | projects. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 708 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 709 | .. attr:: timeout |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 710 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 711 | The time in minutes that the job should be allowed to run before |
| 712 | it is automatically aborted and failure is reported. If no |
| 713 | timeout is supplied, the job may run indefinitely. Supplying a |
| 714 | timeout is highly recommended. |
| 715 | |
| 716 | .. attr:: attempts |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 717 | :default: 3 |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 718 | |
| 719 | When Zuul encounters an error running a job's pre-run playbook, |
| 720 | Zuul will stop and restart the job. Errors during the main or |
| 721 | post-run -playbook phase of a job are not affected by this |
| 722 | parameter (they are reported immediately). This parameter |
| 723 | controls the number of attempts to make before an error is |
James E. Blair | 88d8424 | 2017-07-31 12:05:16 -0700 | [diff] [blame] | 724 | reported. |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 725 | |
| 726 | .. attr:: pre-run |
| 727 | |
| 728 | The name of a playbook or list of playbooks without file |
| 729 | extension to run before the main body of a job. The full path |
| 730 | to the playbook in the repo where the job is defined is |
| 731 | expected. |
| 732 | |
| 733 | When a job inherits from a parent, the child's pre-run playbooks |
| 734 | are run after the parent's. See :ref:`job` for more |
| 735 | information. |
| 736 | |
| 737 | .. attr:: post-run |
| 738 | |
| 739 | The name of a playbook or list of playbooks without file |
| 740 | extension to run after the main body of a job. The full path to |
| 741 | the playbook in the repo where the job is defined is expected. |
| 742 | |
| 743 | When a job inherits from a parent, the child's post-run |
| 744 | playbooks are run before the parent's. See :ref:`job` for more |
| 745 | information. |
| 746 | |
| 747 | .. attr:: run |
| 748 | |
| 749 | The name of the main playbook for this job. This parameter is |
| 750 | not normally necessary, as it defaults to a playbook with the |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 751 | same name as the job inside of the ``playbooks/`` directory |
| 752 | (e.g., the ``foo`` job would default to ``playbooks/foo``. |
| 753 | However, if a playbook with a different name is needed, it can |
| 754 | be specified here. The file extension is not required, but the |
| 755 | full path within the repo is. When a child inherits from a |
| 756 | parent, a playbook with the name of the child job is implicitly |
| 757 | searched first, before falling back on the playbook used by the |
| 758 | parent job (unless the child job specifies a ``run`` attribute, |
| 759 | in which case that value is used). Example: |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 760 | |
| 761 | .. code-block:: yaml |
| 762 | |
| 763 | run: playbooks/<name of the job> |
| 764 | |
| 765 | .. attr:: roles |
| 766 | |
| 767 | A list of Ansible roles to prepare for the job. Because a job |
| 768 | runs an Ansible playbook, any roles which are used by the job |
| 769 | must be prepared and installed by Zuul before the job begins. |
| 770 | This value is a list of dictionaries, each of which indicates |
| 771 | one of two types of roles: a Galaxy role, which is simply a role |
| 772 | that is installed from Ansible Galaxy, or a Zuul role, which is |
| 773 | a role provided by a project managed by Zuul. Zuul roles are |
| 774 | able to benefit from speculative merging and cross-project |
| 775 | dependencies when used by playbooks in untrusted projects. |
| 776 | Roles are added to the Ansible role path in the order they |
| 777 | appear on the job -- roles earlier in the list will take |
| 778 | precedence over those which follow. |
| 779 | |
| 780 | In the case of job inheritance or variance, the roles used for |
| 781 | each of the playbooks run by the job will be only those which |
| 782 | were defined along with that playbook. If a child job inherits |
| 783 | from a parent which defines a pre and post playbook, then the |
| 784 | pre and post playbooks it inherits from the parent job will run |
| 785 | only with the roles that were defined on the parent. If the |
| 786 | child adds its own pre and post playbooks, then any roles added |
| 787 | by the child will be available to the child's playbooks. This |
| 788 | 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] | 789 | inadvertently alter the behavior of the parent's playbooks by |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 790 | the addition of conflicting roles. Roles added by a child will |
| 791 | appear before those it inherits from its parent. |
| 792 | |
| 793 | A project which supplies a role may be structured in one of two |
| 794 | configurations: a bare role (in which the role exists at the |
| 795 | 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] | 796 | exists within the ``roles/`` directory of the project, perhaps |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 797 | 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] | 798 | ``roles/`` directory of the project is added to the role search |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 799 | path. In the case of a bare role, the project itself is added |
| 800 | to the role search path. In case the name of the project is not |
| 801 | the name under which the role should be installed (and therefore |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 802 | referenced from Ansible), the ``name`` attribute may be used to |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 803 | specify an alternate. |
| 804 | |
| 805 | A job automatically has the project in which it is defined added |
| 806 | 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] | 807 | ``roles/`` directory. By default, the project is added to the |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 808 | path under its own name, however, that may be changed by |
| 809 | explicitly listing the project in the roles list in the usual |
| 810 | way. |
| 811 | |
| 812 | .. note:: Galaxy roles are not yet implemented. |
| 813 | |
| 814 | .. attr:: galaxy |
| 815 | |
| 816 | The name of the role in Ansible Galaxy. If this attribute is |
| 817 | supplied, Zuul will search Ansible Galaxy for a role by this |
| 818 | name and install it. Mutually exclusive with ``zuul``; |
| 819 | either ``galaxy`` or ``zuul`` must be supplied. |
| 820 | |
| 821 | .. attr:: zuul |
| 822 | |
| 823 | The name of a Zuul project which supplies the role. Mutually |
| 824 | exclusive with ``galaxy``; either ``galaxy`` or ``zuul`` must |
| 825 | be supplied. |
| 826 | |
| 827 | .. attr:: name |
| 828 | |
| 829 | The installation name of the role. In the case of a bare |
| 830 | role, the role will be made available under this name. |
| 831 | Ignored in the case of a contained role. |
| 832 | |
| 833 | .. attr:: required-projects |
| 834 | |
| 835 | A list of other projects which are used by this job. Any Zuul |
| 836 | projects specified here will also be checked out by Zuul into |
| 837 | the working directory for the job. Speculative merging and |
| 838 | cross-repo dependencies will be honored. |
| 839 | |
| 840 | The format for this attribute is either a list of strings or |
| 841 | dictionaries. Strings are interpreted as project names, |
| 842 | dictionaries, if used, may have the following attributes: |
| 843 | |
| 844 | .. attr:: name |
| 845 | :required: |
| 846 | |
| 847 | The name of the required project. |
| 848 | |
| 849 | .. attr:: override-branch |
| 850 | |
| 851 | When Zuul runs jobs for a proposed change, it normally checks |
| 852 | out the branch associated with that change on every project |
| 853 | present in the job. If jobs are running on a ref (such as a |
| 854 | branch tip or tag), then that ref is normally checked out. |
| 855 | This attribute is used to override that behavior and indicate |
| 856 | that this job should, regardless of the branch for the queue |
| 857 | item, use the indicated branch instead, for only this |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 858 | project. See also the :attr:`job.override-branch` attribute |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 859 | to apply the same behavior to all projects in a job. |
| 860 | |
| 861 | .. attr:: vars |
| 862 | |
| 863 | A dictionary of variables to supply to Ansible. When inheriting |
| 864 | from a job (or creating a variant of a job) vars are merged with |
| 865 | previous definitions. This means a variable definition with the |
| 866 | same name will override a previously defined variable, but new |
| 867 | variable names will be added to the set of defined variables. |
| 868 | |
| 869 | .. attr:: dependencies |
| 870 | |
| 871 | A list of other jobs upon which this job depends. Zuul will not |
| 872 | start executing this job until all of its dependencies have |
| 873 | completed successfully, and if one or more of them fail, this |
| 874 | job will not be run. |
| 875 | |
| 876 | .. attr:: allowed-projects |
| 877 | |
| 878 | A list of Zuul projects which may use this job. By default, a |
| 879 | job may be used by any other project known to Zuul, however, |
| 880 | some jobs use resources or perform actions which are not |
| 881 | appropriate for other projects. In these cases, a list of |
| 882 | projects which are allowed to use this job may be supplied. If |
| 883 | this list is not empty, then it must be an exhaustive list of |
| 884 | all projects permitted to use the job. The current project |
| 885 | (where the job is defined) is not automatically included, so if |
| 886 | 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] | 887 | listed. By default, all projects may use the job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 888 | |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 889 | .. attr:: untrusted-secrets |
| 890 | |
| 891 | A boolean value which indicates that this job should not be used |
| 892 | in a pipeline where allow-secrets is ``false``. This is |
| 893 | automatically set to ``true`` if this job is defined in a |
| 894 | :term:`untrusted-project`. It may be explicitly set to obtain |
| 895 | the same behavior for jobs defined in :term:`config projects |
| 896 | <config-project>`. Once this is set to ``true`` anywhere in the |
| 897 | inheritance hierarchy for a job, it will remain set for all |
| 898 | child jobs and variants (it can not be set to ``false``). |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 899 | |
| 900 | .. _project: |
| 901 | |
| 902 | Project |
| 903 | ~~~~~~~ |
| 904 | |
| 905 | 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] | 906 | configured to interact. The main responsibility of the project |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 907 | configuration item is to specify which jobs should run in which |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 908 | pipelines for a given project. Within each project definition, a |
| 909 | section for each :ref:`pipeline <pipeline>` may appear. This |
| 910 | project-pipeline definition is what determines how a project |
| 911 | participates in a pipeline. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 912 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 913 | Consider the following project definition:: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 914 | |
| 915 | - project: |
| 916 | name: yoyodyne |
| 917 | check: |
| 918 | jobs: |
| 919 | - check-syntax |
| 920 | - unit-tests |
| 921 | gate: |
| 922 | queue: integrated |
| 923 | jobs: |
| 924 | - unit-tests |
| 925 | - integration-tests |
| 926 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 927 | The project has two project-pipeline stanzas, one for the ``check`` |
| 928 | pipeline, and one for ``gate``. Each specifies which jobs should run |
| 929 | when a change for that project enters the respective pipeline -- when |
| 930 | a change enters ``check``, the ``check-syntax`` and ``unit-test`` jobs |
| 931 | are run. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 932 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 933 | Pipelines which use the dependent pipeline manager (e.g., the ``gate`` |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 934 | example shown earlier) maintain separate queues for groups of |
| 935 | projects. When Zuul serializes a set of changes which represent |
| 936 | future potential project states, it must know about all of the |
| 937 | projects within Zuul which may have an effect on the outcome of the |
| 938 | jobs it runs. If project *A* uses project *B* as a library, then Zuul |
| 939 | must be told about that relationship so that it knows to serialize |
| 940 | changes to A and B together, so that it does not merge a change to B |
| 941 | while it is testing a change to A. |
| 942 | |
| 943 | Zuul could simply assume that all projects are related, or even infer |
| 944 | relationships by which projects a job indicates it uses, however, in a |
| 945 | large system that would become unwieldy very quickly, and |
| 946 | unnecessarily delay changes to unrelated projects. To allow for |
| 947 | flexibility in the construction of groups of related projects, the |
| 948 | change queues used by dependent pipeline managers are specified |
| 949 | manually. To group two or more related projects into a shared queue |
| 950 | for a dependent pipeline, set the ``queue`` parameter to the same |
| 951 | value for those projects. |
| 952 | |
James E. Blair | ac3c7ae | 2017-07-31 09:01:08 -0700 | [diff] [blame] | 953 | The ``gate`` project-pipeline definition above specifies that this |
| 954 | project participates in the ``integrated`` shared queue for that |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 955 | pipeline. |
| 956 | |
James E. Blair | 9d4384d | 2017-08-01 15:54:50 -0700 | [diff] [blame] | 957 | .. attr:: project |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 958 | |
James E. Blair | 9d4384d | 2017-08-01 15:54:50 -0700 | [diff] [blame] | 959 | In addition to a project-pipeline definition for one or more |
| 960 | pipelines, the following attributes may appear in a project: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 961 | |
James E. Blair | 9d4384d | 2017-08-01 15:54:50 -0700 | [diff] [blame] | 962 | .. attr:: name |
| 963 | :required: |
| 964 | |
| 965 | The name of the project. If Zuul is configured with two or more |
| 966 | unique projects with the same name, the canonical hostname for |
| 967 | the project should be included (e.g., `git.example.com/foo`). |
| 968 | |
| 969 | .. attr:: templates |
| 970 | |
| 971 | A list of :ref:`project-template` references; the |
| 972 | project-pipeline definitions of each Project Template will be |
| 973 | applied to this project. If more than one template includes |
| 974 | jobs for a given pipeline, they will be combined, as will any |
| 975 | jobs specified in project-pipeline definitions on the project |
| 976 | itself. |
| 977 | |
| 978 | .. attr:: merge-mode |
| 979 | :default: merge-resolve |
| 980 | |
| 981 | The merge mode which is used by Git for this project. Be sure |
| 982 | this matches what the remote system which performs merges (i.e., |
| 983 | Gerrit or GitHub). Must be one of the following values: |
| 984 | |
| 985 | .. value:: merge |
| 986 | |
| 987 | Uses the default git merge strategy (recursive). |
| 988 | |
| 989 | .. value:: merge-resolve |
| 990 | |
| 991 | Uses the resolve git merge strategy. This is a very |
| 992 | conservative merge strategy which most closely matches the |
| 993 | behavior of Gerrit. |
| 994 | |
| 995 | .. value:: cherry-pick |
| 996 | |
| 997 | Cherry-picks each change onto the branch rather than |
| 998 | performing any merges. |
| 999 | |
| 1000 | .. attr:: <pipeline> |
| 1001 | |
| 1002 | Each pipeline that the project participates in should have an |
| 1003 | entry in the project. The value for this key should be a |
| 1004 | dictionary with the following format: |
| 1005 | |
| 1006 | .. attr:: jobs |
| 1007 | :required: |
| 1008 | |
| 1009 | A list of jobs that should be run when items for this project |
| 1010 | are enqueued into the pipeline. Each item of this list may |
| 1011 | be a string, in which case it is treated as a job name, or it |
| 1012 | may be a dictionary, in which case it is treated as a job |
| 1013 | variant local to this project and pipeline. In that case, |
| 1014 | the format of the dictionary is the same as the top level |
| 1015 | :attr:`job` definition. Any attributes set on the job here |
| 1016 | will override previous versions of the job. |
| 1017 | |
| 1018 | .. attr:: queue |
| 1019 | |
| 1020 | If this pipeline is a :value:`dependent |
| 1021 | <pipeline.manager.dependent>` pipeline, this specifies the |
| 1022 | name of the shared queue this project is in. Any projects |
| 1023 | which interact with each other in tests should be part of the |
| 1024 | same shared queue in order to ensure that they don't merge |
| 1025 | changes which break the others. This is a free-form string; |
| 1026 | just set the same value for each group of projects. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1027 | |
| 1028 | .. _project-template: |
| 1029 | |
| 1030 | Project Template |
| 1031 | ~~~~~~~~~~~~~~~~ |
| 1032 | |
| 1033 | A Project Template defines one or more project-pipeline definitions |
| 1034 | which can be re-used by multiple projects. |
| 1035 | |
| 1036 | A Project Template uses the same syntax as a :ref:`project` |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1037 | definition, however, in the case of a template, the |
| 1038 | :attr:`project.name` attribute does not refer to the name of a |
| 1039 | project, but rather names the template so that it can be referenced in |
| 1040 | a `Project` definition. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1041 | |
| 1042 | .. _secret: |
| 1043 | |
| 1044 | Secret |
| 1045 | ~~~~~~ |
| 1046 | |
| 1047 | A Secret is a collection of private data for use by one or more jobs. |
| 1048 | In order to maintain the security of the data, the values are usually |
| 1049 | encrypted, however, data which are not sensitive may be provided |
| 1050 | unencrypted as well for convenience. |
| 1051 | |
| 1052 | 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^] | 1053 | use a secret, a :ref:`job` must specify the secret in |
| 1054 | :attr:`job.secrets`. Secrets are bound to the playbooks associated |
| 1055 | with the specific job definition where they were declared. Additional |
| 1056 | pre or post playbooks which appear in child jobs will not have access |
| 1057 | to the secrets, nor will playbooks which override the main playbook |
| 1058 | (if any) of the job which declared the secret. This protects against |
| 1059 | jobs in other repositories declaring a job with a secret as a parent |
| 1060 | and then exposing that secret. |
James E. Blair | 892cca6 | 2017-08-09 11:36:58 -0700 | [diff] [blame] | 1061 | |
| 1062 | It is possible to use secrets for jobs defined in :term:`config |
| 1063 | projects <config-project>` as well as :term:`untrusted projects |
| 1064 | <untrusted-project>`, however their use differs slightly. Because |
| 1065 | playbooks in a config project which use secrets run in the |
| 1066 | :term:`trusted execution context` where proposed changes are not used |
| 1067 | in executing jobs, it is safe for those secrets to be used in all |
| 1068 | types of pipelines. However, because playbooks defined in an |
| 1069 | untrusted project are run in the :term:`untrusted execution context` |
| 1070 | where proposed changes are used in job execution, it is dangerous to |
| 1071 | allow those secrets to be used in pipelines which are used to execute |
| 1072 | proposed but unreviewed changes. By default, pipelines will refuse to |
| 1073 | run jobs which have playbooks that use secrets in the untrusted |
| 1074 | execution context to protect against someone proposing a change which |
| 1075 | exposes a secret. To permit this (for instance, in a pipeline which |
| 1076 | only runs after code review), the :attr:`pipeline.allow-secrets` |
| 1077 | attribute may be set. |
| 1078 | |
| 1079 | If a job with secrets is unsafe to be used by other projects, the |
| 1080 | `allowed-projects` job attribute can be used to restrict the projects |
| 1081 | which can invoke that job. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1082 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1083 | .. attr:: secret |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1084 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1085 | The following attributes must appear on a secret: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1086 | |
James E. Blair | aafabe9 | 2017-08-02 15:23:19 -0700 | [diff] [blame] | 1087 | .. attr:: name |
| 1088 | :required: |
| 1089 | |
| 1090 | The name of the secret, used in a :ref:`Job` definition to |
| 1091 | request the secret. |
| 1092 | |
| 1093 | .. attr:: data |
| 1094 | :required: |
| 1095 | |
| 1096 | A dictionary which will be added to the Ansible variables |
| 1097 | available to the job. The values can either be plain text |
| 1098 | strings, or encrypted values. See :ref:`encryption` for more |
| 1099 | information. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1100 | |
| 1101 | .. _nodeset: |
| 1102 | |
| 1103 | Nodeset |
| 1104 | ~~~~~~~ |
| 1105 | |
| 1106 | A Nodeset is a named collection of nodes for use by a job. Jobs may |
| 1107 | specify what nodes they require individually, however, by defining |
| 1108 | groups of node types once and referring to them by name, job |
| 1109 | configuration may be simplified. |
| 1110 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1111 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1112 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1113 | - nodeset: |
| 1114 | name: nodeset1 |
| 1115 | nodes: |
| 1116 | - name: controller |
| 1117 | label: controller-label |
| 1118 | - name: compute1 |
| 1119 | label: compute-label |
| 1120 | - name: compute2 |
| 1121 | label: compute-label |
| 1122 | groups: |
| 1123 | - name: ceph-osd |
| 1124 | nodes: |
| 1125 | - controller |
| 1126 | - name: ceph-monitor |
| 1127 | nodes: |
| 1128 | - controller |
| 1129 | - compute1 |
| 1130 | - compute2 |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1131 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1132 | .. attr:: nodeset |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1133 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1134 | A Nodeset requires two attributes: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1135 | |
Tobias Henkel | db686e2 | 2017-08-01 09:15:31 +0200 | [diff] [blame] | 1136 | .. attr:: name |
| 1137 | :required: |
| 1138 | |
| 1139 | The name of the Nodeset, to be referenced by a :ref:`job`. |
| 1140 | |
| 1141 | .. attr:: nodes |
| 1142 | :required: |
| 1143 | |
| 1144 | A list of node definitions, each of which has the following format: |
| 1145 | |
| 1146 | .. attr:: name |
| 1147 | :required: |
| 1148 | |
| 1149 | The name of the node. This will appear in the Ansible inventory |
| 1150 | for the job. |
| 1151 | |
| 1152 | .. attr:: label |
| 1153 | :required: |
| 1154 | |
| 1155 | The Nodepool label for the node. Zuul will request a node with |
| 1156 | this label. |
| 1157 | |
| 1158 | .. attr:: groups |
| 1159 | |
| 1160 | Additional groups can be defined which are accessible from the ansible |
| 1161 | playbooks. |
| 1162 | |
| 1163 | .. attr:: name |
| 1164 | :required: |
| 1165 | |
| 1166 | The name of the group to be referenced by an ansible playbook. |
| 1167 | |
| 1168 | .. attr:: nodes |
| 1169 | :required: |
| 1170 | |
| 1171 | The nodes that shall be part of the group. This is specified as a list |
| 1172 | of strings. |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1173 | |
| 1174 | .. _semaphore: |
| 1175 | |
| 1176 | Semaphore |
| 1177 | ~~~~~~~~~ |
| 1178 | |
| 1179 | Semaphores can be used to restrict the number of certain jobs which |
| 1180 | are running at the same time. This may be useful for jobs which |
| 1181 | access shared or limited resources. A semaphore has a value which |
| 1182 | represents the maximum number of jobs which use that semaphore at the |
| 1183 | same time. |
| 1184 | |
| 1185 | Semaphores are never subject to dynamic reconfiguration. If the value |
| 1186 | 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] | 1187 | where it is updated is merged. An example follows: |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1188 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1189 | .. code-block:: yaml |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1190 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1191 | - semaphore: |
| 1192 | name: semaphore-foo |
| 1193 | max: 5 |
| 1194 | - semaphore: |
| 1195 | name: semaphore-bar |
| 1196 | max: 3 |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1197 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1198 | .. attr:: semaphore |
James E. Blair | 1de8d40 | 2017-05-07 17:08:04 -0700 | [diff] [blame] | 1199 | |
Tobias Henkel | 7683298 | 2017-08-01 08:37:40 +0200 | [diff] [blame] | 1200 | The following attributes are available: |
| 1201 | |
| 1202 | .. attr:: name |
| 1203 | :required: |
| 1204 | |
| 1205 | The name of the semaphore, referenced by jobs. |
| 1206 | |
| 1207 | .. attr:: max |
| 1208 | :default: 1 |
| 1209 | |
| 1210 | The maximum number of running jobs which can use this semaphore. |