James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 1 | :title: Zuul |
| 2 | |
| 3 | Zuul |
| 4 | ==== |
| 5 | |
| 6 | Configuration |
| 7 | ------------- |
| 8 | |
| 9 | Zuul has three configuration files: |
| 10 | |
| 11 | **zuul.conf** |
| 12 | Credentials for Gerrit and Jenkins, locations of the other config files |
| 13 | **layout.yaml** |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 14 | Project and pipeline configuration -- what Zuul does |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 15 | **logging.conf** |
| 16 | Python logging config |
| 17 | |
| 18 | Examples of each of the three files can be found in the etc/ directory |
| 19 | of the source distribution. |
| 20 | |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 21 | .. _zuulconf: |
| 22 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 23 | zuul.conf |
| 24 | ~~~~~~~~~ |
| 25 | |
| 26 | Zuul will look for ``/etc/zuul/zuul.conf`` or ``~/zuul.conf`` to |
| 27 | bootstrap its configuration. Alternately, you may specify ``-c |
| 28 | /path/to/zuul.conf`` on the command line. |
| 29 | |
| 30 | Gerrit and Jenkins credentials are each described in a section of |
| 31 | zuul.conf. The location of the other two configuration files (as well |
| 32 | as the location of the PID file when running Zuul as a server) are |
| 33 | specified in a third section. |
| 34 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 35 | The three sections of this config and their options are documented below. |
| 36 | You can also find an example zuul.conf file in the git |
| 37 | `repository |
K Jonathan Harker | 97e457e | 2013-02-26 13:29:38 -0800 | [diff] [blame] | 38 | <https://github.com/openstack-infra/zuul/blob/master/etc/zuul.conf-sample>`_ |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 39 | |
| 40 | jenkins |
| 41 | """"""" |
| 42 | |
| 43 | **server** |
| 44 | URL for the root of the Jenkins HTTP server. |
| 45 | ``server=https://jenkins.example.com`` |
| 46 | |
| 47 | **user** |
| 48 | User to authenticate against Jenkins with. |
| 49 | ``user=jenkins`` |
| 50 | |
| 51 | **apikey** |
| 52 | Jenkins API Key credentials for the above user. |
| 53 | ``apikey=1234567890abcdef1234567890abcdef`` |
| 54 | |
| 55 | gerrit |
| 56 | """""" |
| 57 | |
| 58 | **server** |
| 59 | FQDN of Gerrit server. |
| 60 | ``server=review.example.com`` |
| 61 | |
Antoine Musso | 2747501 | 2012-11-26 09:53:01 +0100 | [diff] [blame] | 62 | **baseurl** |
| 63 | Optional: path to Gerrit web interface. Defaults to ``https://<value |
| 64 | of server>/``. ``baseurl=https://review.example.com/review_site/`` |
| 65 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 66 | **user** |
| 67 | User name to use when logging into above server via ssh. |
| 68 | ``user=jenkins`` |
| 69 | |
| 70 | **sshkey** |
| 71 | Path to SSH key to use when logging into above server. |
| 72 | ``sshkey=/home/jenkins/.ssh/id_rsa`` |
| 73 | |
| 74 | zuul |
| 75 | """" |
| 76 | |
| 77 | **layout_config** |
| 78 | Path to layout config file. |
| 79 | ``layout_config=/etc/zuul/layout.yaml`` |
| 80 | |
| 81 | **log_config** |
| 82 | Path to log config file. |
| 83 | ``log_config=/etc/zuul/logging.yaml`` |
| 84 | |
| 85 | **pidfile** |
| 86 | Path to PID lock file. |
| 87 | ``pidfile=/var/run/zuul/zuul.pid`` |
| 88 | |
| 89 | **state_dir** |
| 90 | Path to directory that Zuul should save state to. |
| 91 | ``state_dir=/var/lib/zuul`` |
| 92 | |
| 93 | **git_dir** |
| 94 | Directory that Zuul should clone local git repositories to. |
| 95 | ``git_dir=/var/lib/zuul/git`` |
| 96 | |
| 97 | **push_change_refs** |
| 98 | Boolean value (``true`` or ``false``) that determines if Zuul should |
| 99 | push change refs to the git origin server for the git repositories in |
| 100 | git_dir. |
| 101 | ``push_change_refs=true`` |
| 102 | |
James E. Blair | 0ac6c01 | 2013-04-26 09:04:23 -0700 | [diff] [blame^] | 103 | **report_times** |
| 104 | Boolean value (``true`` or ``false``) that determines if Zuul should |
| 105 | include elapsed times for each job in the textual report. |
| 106 | ``report_times=true`` |
| 107 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 108 | **status_url** |
| 109 | URL that will be posted in Zuul comments made to Gerrit changes when |
| 110 | beginning Jenkins jobs for a change. |
| 111 | ``status_url=https://jenkins.example.com/zuul/status`` |
| 112 | |
| 113 | **url_pattern** |
| 114 | If you are storing build logs external to Jenkins and wish to link to |
| 115 | those logs when Zuul makes comments on Gerrit changes for completed |
| 116 | jobs this setting configures what the URLs for those links should be. |
| 117 | ``http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}`` |
| 118 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 119 | layout.yaml |
| 120 | ~~~~~~~~~~~ |
| 121 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 122 | This is the main configuration file for Zuul, where all of the pipelines |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 123 | and projects are defined, what tests should be run, and what actions |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 124 | Zuul should perform. There are three sections: pipelines, jobs, and |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 125 | projects. |
| 126 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 127 | .. _includes: |
| 128 | |
| 129 | Includes |
| 130 | """""""" |
| 131 | |
| 132 | Custom functions to be used in Zuul's configuration may be provided |
| 133 | using the ``includes`` directive. It accepts a list of files to |
| 134 | include, and currently supports one type of inclusion, a python file:: |
| 135 | |
| 136 | includes: |
| 137 | - python-file: local_functions.py |
| 138 | |
| 139 | **python-file** |
| 140 | The path to a python file. The file will be loaded and objects that |
| 141 | it defines will be placed in a special environment which can be |
| 142 | referenced in the Zuul configuration. Currently only the |
| 143 | parameter-function attribute of a Job uses this feature. |
| 144 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 145 | Pipelines |
| 146 | """"""""" |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 147 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 148 | Zuul can have any number of independent pipelines. Whenever a matching |
| 149 | Gerrit event is found for a pipeline, that event is added to the |
| 150 | pipeline, and the jobs specified for that pipeline are run. When all |
| 151 | jobs specified for the pipeline that were triggered by an event are |
| 152 | completed, Zuul reports back to Gerrit the results. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 153 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 154 | There are no pre-defined pipelines in Zuul, rather you can define |
| 155 | whatever pipelines you need in the layout file. This is a very flexible |
| 156 | system that can accommodate many kinds of workflows. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 157 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 158 | Here is a quick example of a pipeline definition followed by an |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 159 | explanation of each of the parameters:: |
| 160 | |
| 161 | - name: check |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 162 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 163 | trigger: |
| 164 | - event: patchset-created |
| 165 | success: |
| 166 | verified: 1 |
| 167 | failure: |
| 168 | verified: -1 |
| 169 | |
| 170 | **name** |
| 171 | This is used later in the project definition to indicate what jobs |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 172 | should be run for events in the pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 173 | |
James E. Blair | 8dbd56a | 2012-12-22 10:55:10 -0800 | [diff] [blame] | 174 | **description** |
| 175 | This is an optional field that may be used to provide a textual |
| 176 | description of the pipeline. |
| 177 | |
James E. Blair | 5637019 | 2013-01-14 15:47:28 -0800 | [diff] [blame] | 178 | **success-message** |
| 179 | An optional field that supplies the introductory text in message |
| 180 | reported back to Gerrit when all the voting builds are successful. |
| 181 | Defaults to "Build successful." |
| 182 | |
| 183 | **failure-message** |
| 184 | An optional field that supplies the introductory text in message |
| 185 | reported back to Gerrit when at least one voting build fails. |
| 186 | Defaults to "Build failed." |
| 187 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 188 | **manager** |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 189 | There are currently two schemes for managing pipelines: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 190 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 191 | *IndependentPipelineManager* |
| 192 | Every event in this pipeline should be treated as independent of |
| 193 | other events in the pipeline. This is appropriate when the order of |
| 194 | events in the pipeline doesn't matter because the results of the |
| 195 | actions this pipeline performs can not affect other events in the |
| 196 | pipeline. For example, when a change is first uploaded for review, |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 197 | you may want to run tests on that change to provide early feedback |
| 198 | to reviewers. At the end of the tests, the change is not going to |
| 199 | be merged, so it is safe to run these tests in parallel without |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 200 | regard to any other changes in the pipeline. They are independent. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 201 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 202 | Another type of pipeline that is independent is a post-merge |
| 203 | pipeline. In that case, the changes have already merged, so the |
| 204 | results can not affect any other events in the pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 205 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 206 | *DependentPipelineManager* |
| 207 | The dependent pipeline manager is designed for gating. It ensures |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 208 | that every change is tested exactly as it is going to be merged |
| 209 | into the repository. An ideal gating system would test one change |
| 210 | at a time, applied to the tip of the repository, and only if that |
| 211 | change passed tests would it be merged. Then the next change in |
| 212 | line would be tested the same way. In order to achieve parallel |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 213 | testing of changes, the dependent pipeline manager performs |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 214 | speculative execution on changes. It orders changes based on |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 215 | their entry into the pipeline. It begins testing all changes in |
| 216 | parallel, assuming that each change ahead in the pipeline will pass |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 217 | its tests. If they all succeed, all the changes can be tested and |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 218 | merged in parallel. If a change near the front of the pipeline |
| 219 | fails its tests, each change behind it ignores whatever tests have |
| 220 | been completed and are tested again without the change in front. |
| 221 | This way gate tests may run in parallel but still be tested |
| 222 | correctly, exactly as they will appear in the repository when |
| 223 | merged. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 224 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 225 | One important characteristic of the DependentPipelineManager is that |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 226 | it analyzes the jobs that are triggered by different projects, and |
| 227 | if those projects have jobs in common, it treats those projects as |
| 228 | related, and they share a single virtual queue of changes. Thus, |
| 229 | if there is a job that performs integration testing on two |
| 230 | projects, those two projects will automatically share a virtual |
| 231 | change queue. If a third project does not invoke that job, it |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 232 | will be part of a separate virtual change queue, and changes to |
| 233 | it will not depend on changes to the first two jobs. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 234 | |
| 235 | For more detail on the theory and operation of Zuul's |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 236 | DependentPipelineManager, see: :doc:`gating`. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 237 | |
| 238 | **trigger** |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 239 | This describes what Gerrit events should be placed in the pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 240 | Triggers are not exclusive -- matching events may be placed in |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 241 | multiple pipelines, and they will behave independently in each of the |
| 242 | pipelines they match. Multiple triggers may be listed. Further |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 243 | parameters describe the kind of events that match: |
| 244 | |
| 245 | *event* |
| 246 | The event name from gerrit. Examples: ``patchset-created``, |
| 247 | ``comment-added``, ``ref-updated``. This field is treated as a |
| 248 | regular expression. |
| 249 | |
| 250 | *branch* |
| 251 | The branch associated with the event. Example: ``master``. This |
| 252 | field is treated as a regular expression, and multiple branches may |
| 253 | be listed. |
| 254 | |
| 255 | *ref* |
| 256 | On ref-updated events, the branch parameter is not used, instead the |
| 257 | ref is provided. Currently Gerrit has the somewhat idiosyncratic |
| 258 | behavior of specifying bare refs for branch names (e.g., ``master``), |
| 259 | but full ref names for other kinds of refs (e.g., ``refs/tags/foo``). |
| 260 | Zuul matches what you put here exactly against what Gerrit |
| 261 | provides. This field is treated as a regular expression, and |
| 262 | multiple refs may be listed. |
| 263 | |
| 264 | *approval* |
| 265 | This is only used for ``comment-added`` events. It only matches if |
| 266 | the event has a matching approval associated with it. Example: |
| 267 | ``code-review: 2`` matches a ``+2`` vote on the code review category. |
| 268 | Multiple approvals may be listed. |
| 269 | |
Antoine Musso | b4e809e | 2012-12-06 16:58:06 +0100 | [diff] [blame] | 270 | *email_filter* |
| 271 | This is used for any event. It takes a regex applied on the performer |
Antoine Musso | 5f11042 | 2012-12-18 23:22:13 +0100 | [diff] [blame] | 272 | email, i.e Gerrit account email address. If you want to specify |
| 273 | several email filters, you must use a YAML list. Make sure to use non |
| 274 | greedy matchers and to escapes dots! |
| 275 | Example: ``email_filter: ^.*?@example\.org$``. |
Antoine Musso | b4e809e | 2012-12-06 16:58:06 +0100 | [diff] [blame] | 276 | |
Clark Boylan | b9bcb40 | 2012-06-29 17:44:05 -0700 | [diff] [blame] | 277 | *comment_filter* |
| 278 | This is only used for ``comment-added`` events. It accepts a list of |
| 279 | regexes that are searched for in the comment string. If any of these |
| 280 | regexes matches a portion of the comment string the trigger is |
| 281 | matched. ``comment_filter: retrigger`` will match when comments |
| 282 | containing 'retrigger' somewhere in the comment text are added to a |
| 283 | change. |
| 284 | |
James E. Blair | 2fa5096 | 2013-01-30 21:50:41 -0800 | [diff] [blame] | 285 | **dequeue-on-new-patchset** |
| 286 | Normally, if a new patchset is uploaded to a change that is in a |
| 287 | pipeline, the existing entry in the pipeline will be removed (with |
| 288 | jobs canceled and any dependent changes that can no longer merge as |
| 289 | well. To suppress this behavior (and allow jobs to continue |
| 290 | running), set this to ``false``. Default: ``true``. |
| 291 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 292 | **success** |
| 293 | Describes what Zuul should do if all the jobs complete successfully. |
| 294 | This section is optional; if it is omitted, Zuul will run jobs and |
| 295 | do nothing on success; it will not even report a message to Gerrit. |
| 296 | If the section is present, it will leave a message on the Gerrit |
| 297 | review. Each additional argument is assumed to be an argument to |
| 298 | ``gerrit review``, with the boolean value of ``true`` simply |
| 299 | indicating that the argument should be present without following it |
| 300 | with a value. For example, ``verified: 1`` becomes ``gerrit |
| 301 | review --verified 1`` and ``submit: true`` becomes ``gerrit review |
| 302 | --submit``. |
| 303 | |
| 304 | **failure** |
| 305 | Uses the same syntax as **success**, but describes what Zuul should |
| 306 | do if at least one job fails. |
James E. Blair | dc25386 | 2012-06-13 17:12:42 -0700 | [diff] [blame] | 307 | |
| 308 | **start** |
| 309 | Uses the same syntax as **success**, but describes what Zuul should |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 310 | do when a change is added to the pipeline manager. This can be used, |
James E. Blair | dc25386 | 2012-06-13 17:12:42 -0700 | [diff] [blame] | 311 | for example, to reset the value of the Verified review category. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 312 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 313 | Some example pipeline configurations are included in the sample layout |
| 314 | file. The first is called a *check* pipeline:: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 315 | |
| 316 | - name: check |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 317 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 318 | trigger: |
| 319 | - event: patchset-created |
| 320 | success: |
| 321 | verified: 1 |
| 322 | failure: |
| 323 | verified: -1 |
| 324 | |
| 325 | This will trigger jobs each time a new patchset (or change) is |
| 326 | uploaded to Gerrit, and report +/-1 values to Gerrit in the |
| 327 | ``verified`` review category. :: |
| 328 | |
| 329 | - name: gate |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 330 | manager: DependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 331 | trigger: |
| 332 | - event: comment-added |
| 333 | approval: |
| 334 | - approved: 1 |
| 335 | success: |
| 336 | verified: 2 |
| 337 | submit: true |
| 338 | failure: |
| 339 | verified: -2 |
| 340 | |
| 341 | This will trigger jobs whenever a reviewer leaves a vote of ``1`` in the |
| 342 | ``approved`` review category in Gerrit (a non-standard category). |
| 343 | Changes will be tested in such a way as to guarantee that they will be |
| 344 | merged exactly as tested, though that will happen in parallel by |
| 345 | creating a virtual queue of dependent changes and performing |
| 346 | speculative execution of jobs. :: |
| 347 | |
| 348 | - name: post |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 349 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 350 | trigger: |
| 351 | - event: ref-updated |
| 352 | ref: ^(?!refs/).*$ |
| 353 | |
| 354 | This will trigger jobs whenever a change is merged to a named branch |
| 355 | (e.g., ``master``). No output will be reported to Gerrit. This is |
| 356 | useful for side effects such as creating per-commit tarballs. :: |
| 357 | |
| 358 | - name: silent |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 359 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 360 | trigger: |
| 361 | - event: patchset-created |
| 362 | |
| 363 | This also triggers jobs when changes are uploaded to Gerrit, but no |
| 364 | results are reported to Gerrit. This is useful for jobs that are in |
Antoine Musso | ce33384 | 2012-10-16 14:42:35 +0200 | [diff] [blame] | 365 | development and not yet ready to be presented to developers. :: |
| 366 | |
| 367 | pipelines: |
| 368 | - name: post-merge |
| 369 | manager: IndependentPipelineManager |
| 370 | trigger: |
| 371 | - event: change-merged |
| 372 | success: |
| 373 | force-message: True |
| 374 | failure: |
| 375 | force-message: True |
| 376 | |
| 377 | The ``change-merged`` events happen when a change has been merged in the git |
| 378 | repository. The change is thus closed and Gerrit will not accept modifications |
| 379 | to the review scoring such as ``code-review`` or ``verified``. By using the |
| 380 | ``force-message: True`` parameter, Zuul will pass ``--force-message`` to the |
| 381 | ``gerrit review`` command, thus making sure the message is actually |
| 382 | sent back to Gerrit regardless of approval scores. |
| 383 | That kind of pipeline is nice to run regression or performance tests. |
| 384 | |
| 385 | .. note:: |
| 386 | The ``change-merged`` event does not include the commit sha1 which can be |
| 387 | hazardous, it would let you report back to Gerrit though. If you were to |
| 388 | build a tarball for a specific commit, you should consider insteading using |
| 389 | the ``ref-updated`` event which does include the commit sha1 (but lack the |
| 390 | Gerrit change number). |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 391 | |
| 392 | Jobs |
| 393 | """" |
| 394 | |
| 395 | The jobs section is optional, and can be used to set attributes of |
| 396 | jobs that are independent of their association with a project. For |
| 397 | example, if a job should return a customized message on failure, that |
| 398 | may be specified here. Otherwise, Zuul does not need to be told about |
| 399 | each job as it builds a list from the project specification. |
| 400 | |
| 401 | **name** |
| 402 | The name of the job. This field is treated as a regular expression |
| 403 | and will be applied to each job that matches. |
| 404 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 405 | **failure-message (optional)** |
| 406 | The message that should be reported to Gerrit if the job fails. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 407 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 408 | **success-message (optional)** |
| 409 | The message that should be reported to Gerrit if the job fails. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 410 | |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 411 | **failure-pattern (optional)** |
| 412 | The URL that should be reported to Gerrit if the job fails. |
| 413 | Defaults to the Jenkins build URL or the url_pattern configured in |
| 414 | zuul.conf. May be supplied as a string pattern with substitutions |
| 415 | as described in url_pattern in :ref:`zuulconf`. |
| 416 | |
| 417 | **success-pattern (optional)** |
| 418 | The URL that should be reported to Gerrit if the job succeeds. |
| 419 | Defaults to the Jenkins build URL or the url_pattern configured in |
| 420 | zuul.conf. May be supplied as a string pattern with substitutions |
| 421 | as described in url_pattern in :ref:`zuulconf`. |
| 422 | |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 423 | **hold-following-changes (optional)** |
| 424 | This is a boolean that indicates that changes that follow this |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 425 | change in a dependent change pipeline should wait until this job |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 426 | succeeds before launching. If this is applied to a very short job |
| 427 | that can predict whether longer jobs will fail early, this can be |
| 428 | used to reduce the number of jobs that Zuul will launch and |
| 429 | ultimately have to cancel. In that case, a small amount of |
| 430 | paralellization of jobs is traded for more efficient use of testing |
| 431 | resources. On the other hand, to apply this to a long running job |
| 432 | would largely defeat the parallelization of dependent change testing |
| 433 | that is the main feature of Zuul. The default is False. |
| 434 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 435 | **branch (optional)** |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 436 | This job should only be run on matching branches. This field is |
| 437 | treated as a regular expression and multiple branches may be |
| 438 | listed. |
| 439 | |
James E. Blair | 70c7158 | 2013-03-06 08:50:50 -0800 | [diff] [blame] | 440 | **files (optional)** |
| 441 | This job should only be run if at least one of the files involved in |
| 442 | the change (added, deleted, or modified) matches at least one of the |
| 443 | file patterns listed here. This field is treated as a regular |
| 444 | expression and multiple expressions may be listed. |
| 445 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 446 | **parameter-function (optional)** |
| 447 | Specifies a function that should be applied to the parameters before |
| 448 | the job is launched. The function should be defined in a python file |
| 449 | included with the :ref:`includes` directive. The function |
| 450 | should have the following signature: |
| 451 | |
| 452 | .. function:: parameters(change, parameters) |
| 453 | |
| 454 | Manipulate the parameters passed to a job before a build is |
| 455 | launched. The ``parameters`` dictionary will already contain the |
| 456 | standard Zuul job parameters, and is expected to be modified |
| 457 | in-place. |
| 458 | |
| 459 | :param change: the current change |
| 460 | :type change: zuul.model.Change |
| 461 | :param parameters: parameters to be passed to the job |
| 462 | :type parameters: dict |
| 463 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 464 | Here is an example of setting the failure message for jobs that check |
| 465 | whether a change merges cleanly:: |
| 466 | |
| 467 | - name: ^.*-merge$ |
| 468 | failure-message: This change was unable to be automatically merged |
| 469 | with the current state of the repository. Please rebase your |
| 470 | change and upload a new patchset. |
| 471 | |
| 472 | Projects |
| 473 | """""""" |
| 474 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 475 | The projects section indicates what jobs should be run in each pipeline |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 476 | for events associated with each project. It contains a list of |
| 477 | projects. Here is an example:: |
| 478 | |
| 479 | - name: example/project |
| 480 | check: |
| 481 | - project-merge: |
| 482 | - project-unittest |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 483 | - project-pep8 |
| 484 | - project-pyflakes |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 485 | gate: |
| 486 | - project-merge: |
| 487 | - project-unittest |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 488 | - project-pep8 |
| 489 | - project-pyflakes |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 490 | post: |
| 491 | - project-publish |
| 492 | |
| 493 | **name** |
| 494 | The name of the project (as known by Gerrit). |
| 495 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 496 | This is followed by a section for each of the pipelines defined above. |
| 497 | Pipelines may be omitted if no jobs should run for this project in a |
| 498 | given pipeline. Within the pipeline section, the jobs that should be |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 499 | executed are listed. If a job is entered as a dictionary key, then |
| 500 | jobs contained within that key are only executed if the key job |
| 501 | succeeds. In the above example, project-unittest, project-pep8, and |
| 502 | project-pyflakes are only executed if project-merge succeeds. This |
| 503 | can help avoid running unnecessary jobs. |
| 504 | |
Paul Belanger | ffef9e4 | 2013-02-11 22:15:18 -0500 | [diff] [blame] | 505 | .. seealso:: The OpenStack Zuul configuration for a comprehensive example: https://github.com/openstack-infra/config/blob/master/modules/openstack_project/files/zuul/layout.yaml |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 506 | |
| 507 | |
| 508 | logging.conf |
| 509 | ~~~~~~~~~~~~ |
| 510 | This file is optional. If provided, it should be a standard |
| 511 | :mod:`logging.config` module configuration file. If not present, Zuul will |
| 512 | output all log messages of DEBUG level or higher to the console. |
| 513 | |
| 514 | Starting Zuul |
| 515 | ------------- |
| 516 | |
| 517 | To start Zuul, run **zuul-server**:: |
| 518 | |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 519 | usage: zuul-server [-h] [-c CONFIG] [-l LAYOUT] [-d] [-t] [--version] |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 520 | |
| 521 | Project gating system. |
| 522 | |
| 523 | optional arguments: |
| 524 | -h, --help show this help message and exit |
| 525 | -c CONFIG specify the config file |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 526 | -l LAYOUT specify the layout file |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 527 | -d do not run as a daemon |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 528 | -t validate layout file syntax |
| 529 | --version show zuul version |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 530 | |
| 531 | You may want to use the ``-d`` argument while you are initially setting |
| 532 | up Zuul so you can detect any configuration errors quickly. Under |
| 533 | normal operation, omit ``-d`` and let Zuul run as a daemon. |
| 534 | |
| 535 | If you send signal 1 (SIGHUP) to the zuul-server process, Zuul will |
| 536 | stop executing new jobs, wait until all executing jobs are finished, |
| 537 | reload its configuration, and resume. Any values in any of the |
| 538 | configuration files may be changed, except the location of Zuul's PID |
| 539 | file (a change to that will be ignored until Zuul is restarted). |
Clark Boylan | f231fa2 | 2013-02-08 12:28:53 -0800 | [diff] [blame] | 540 | |
| 541 | If you send a SIGUSR1 to the zuul-server process, Zuul will stop |
| 542 | executing new jobs, wait until all executing jobs are finished, |
| 543 | then exit. While waiting to exit Zuul will queue Gerrit events and |
| 544 | save these events prior to exiting. When Zuul starts again it will |
| 545 | read these saved events and act on them. |
Jeremy Stanley | 93e05f4 | 2013-03-08 17:29:17 +0000 | [diff] [blame] | 546 | |
| 547 | If you need to abort zuul and intend to manually requeue changes for |
| 548 | jobs which were running in its pipelines, prior to terminating you can |
| 549 | use the zuul-changes.py tool script to simplify the process. For |
| 550 | example, this would give you a list of Gerrit commands to reverify or |
| 551 | recheck changes for the gate and check pipelines respectively:: |
| 552 | |
| 553 | ./tools/zuul-changes.py --review-host=review.openstack.org \ |
| 554 | http://zuul.openstack.org/ gate 'reverify no bug' |
| 555 | ./tools/zuul-changes.py --review-host=review.openstack.org \ |
| 556 | http://zuul.openstack.org/ check 'recheck no bug' |