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