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