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** |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 12 | Connection information for Gerrit and Gearman, locations of the |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 13 | other config files. (required) |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 14 | **layout.yaml** |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 15 | Project and pipeline configuration -- what Zuul does. (required) |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 16 | **logging.conf** |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 17 | Python logging config. (optional) |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 18 | |
| 19 | Examples of each of the three files can be found in the etc/ directory |
| 20 | of the source distribution. |
| 21 | |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 22 | .. _zuulconf: |
| 23 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 24 | zuul.conf |
| 25 | ~~~~~~~~~ |
| 26 | |
| 27 | Zuul will look for ``/etc/zuul/zuul.conf`` or ``~/zuul.conf`` to |
| 28 | bootstrap its configuration. Alternately, you may specify ``-c |
| 29 | /path/to/zuul.conf`` on the command line. |
| 30 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 31 | Gerrit and Gearman connection information are each described in a |
| 32 | section of zuul.conf. The location of the other two configuration |
| 33 | files (as well as the location of the PID file when running Zuul as a |
| 34 | server) are specified in a third section. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 35 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 36 | The three sections of this config and their options are documented below. |
| 37 | You can also find an example zuul.conf file in the git |
| 38 | `repository |
Andreas Jaeger | bcfbf93 | 2014-09-29 20:21:44 +0200 | [diff] [blame] | 39 | <https://git.openstack.org/cgit/openstack-infra/zuul/tree/etc/zuul.conf-sample>`_ |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 40 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 41 | gearman |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 42 | """"""" |
| 43 | |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 44 | Client connection information for gearman. If using Zuul's builtin gearmand |
| 45 | server just set **server** to 127.0.0.1. |
| 46 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 47 | **server** |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 48 | Hostname or IP address of the Gearman server. |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 49 | ``server=gearman.example.com`` (required) |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 50 | |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 51 | **port** |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 52 | Port on which the Gearman server is listening. |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 53 | ``port=4730`` (optional) |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 54 | |
James E. Blair | 77cc7b8 | 2013-07-15 13:22:37 -0700 | [diff] [blame] | 55 | gearman_server |
| 56 | """""""""""""" |
| 57 | |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 58 | The builtin gearman server. Zuul can fork a gearman process from itself rather |
| 59 | than connecting to an external one. |
| 60 | |
James E. Blair | 77cc7b8 | 2013-07-15 13:22:37 -0700 | [diff] [blame] | 61 | **start** |
| 62 | Whether to start the internal Gearman server (default: False). |
| 63 | ``start=true`` |
| 64 | |
James E. Blair | 0ac452e | 2015-07-22 09:05:16 -0700 | [diff] [blame] | 65 | **listen_address** |
| 66 | IP address or domain name on which to listen (default: all addresses). |
| 67 | ``listen_address=127.0.0.1`` |
| 68 | |
James E. Blair | 77cc7b8 | 2013-07-15 13:22:37 -0700 | [diff] [blame] | 69 | **log_config** |
| 70 | Path to log config file for internal Gearman server. |
| 71 | ``log_config=/etc/zuul/gearman-logging.yaml`` |
| 72 | |
Paul Belanger | 88ef0ea | 2015-12-23 11:57:02 -0500 | [diff] [blame] | 73 | webapp |
| 74 | """""" |
| 75 | |
| 76 | **listen_address** |
| 77 | IP address or domain name on which to listen (default: 0.0.0.0). |
| 78 | ``listen_address=127.0.0.1`` |
| 79 | |
| 80 | **port** |
| 81 | Port on which the webapp is listening (default: 8001). |
| 82 | ``port=8008`` |
| 83 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 84 | zuul |
| 85 | """" |
| 86 | |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 87 | Zuul's main configuration section. At minimum zuul must be able to find |
| 88 | layout.yaml to be useful. |
| 89 | |
| 90 | .. note:: Must be provided when running zuul-server |
| 91 | |
Antoine Musso | 9adc6d4 | 2014-11-14 15:37:48 +0100 | [diff] [blame] | 92 | .. _layout_config: |
| 93 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 94 | **layout_config** |
James E. Blair | 4076e2b | 2014-01-28 12:42:20 -0800 | [diff] [blame] | 95 | Path to layout config file. Used by zuul-server only. |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 96 | ``layout_config=/etc/zuul/layout.yaml`` |
| 97 | |
| 98 | **log_config** |
James E. Blair | a443013 | 2014-02-17 08:32:07 -0800 | [diff] [blame] | 99 | Path to log config file. Used by zuul-server only. |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 100 | ``log_config=/etc/zuul/logging.yaml`` |
| 101 | |
| 102 | **pidfile** |
James E. Blair | a443013 | 2014-02-17 08:32:07 -0800 | [diff] [blame] | 103 | Path to PID lock file. Used by zuul-server only. |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 104 | ``pidfile=/var/run/zuul/zuul.pid`` |
| 105 | |
| 106 | **state_dir** |
James E. Blair | 4076e2b | 2014-01-28 12:42:20 -0800 | [diff] [blame] | 107 | Path to directory that Zuul should save state to. Used by all Zuul |
| 108 | commands. |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 109 | ``state_dir=/var/lib/zuul`` |
| 110 | |
David Shrewsbury | d678429 | 2017-04-13 12:08:29 -0400 | [diff] [blame] | 111 | **jobroot_dir** |
| 112 | Path to directory that Zuul should store temporary job files. |
| 113 | ``jobroot_dir=/tmp`` |
| 114 | |
James E. Blair | 4076e2b | 2014-01-28 12:42:20 -0800 | [diff] [blame] | 115 | **report_times** |
| 116 | Boolean value (``true`` or ``false``) that determines if Zuul should |
| 117 | include elapsed times for each job in the textual report. Used by |
| 118 | zuul-server only. |
| 119 | ``report_times=true`` |
| 120 | |
| 121 | **status_url** |
| 122 | URL that will be posted in Zuul comments made to Gerrit changes when |
| 123 | starting jobs for a change. Used by zuul-server only. |
| 124 | ``status_url=https://zuul.example.com/status`` |
| 125 | |
Clark Boylan | e0b4bdb | 2014-06-03 17:01:25 -0700 | [diff] [blame] | 126 | **status_expiry** |
| 127 | Zuul will cache the status.json file for this many seconds. This is an |
| 128 | optional value and ``1`` is used by default. |
| 129 | ``status_expiry=1`` |
| 130 | |
James E. Blair | 4076e2b | 2014-01-28 12:42:20 -0800 | [diff] [blame] | 131 | **job_name_in_report** |
| 132 | Boolean value (``true`` or ``false``) that indicates whether the |
| 133 | job name should be included in the report (normally only the URL |
| 134 | is included). Defaults to ``false``. Used by zuul-server only. |
| 135 | ``job_name_in_report=true`` |
| 136 | |
| 137 | merger |
| 138 | """""" |
| 139 | |
Thanh Ha | 266cbb8 | 2016-01-24 20:57:59 -0500 | [diff] [blame] | 140 | The zuul-merger process configuration. Detailed documentation on this process |
| 141 | can be found on the :doc:`merger` page. |
| 142 | |
| 143 | .. note:: Must be provided when running zuul-merger. Both services may share the |
| 144 | same configuration (and even host) or otherwise have an individual |
| 145 | zuul.conf. |
| 146 | |
Clark Boylan | 9b67090 | 2012-09-28 13:47:56 -0700 | [diff] [blame] | 147 | **git_dir** |
| 148 | Directory that Zuul should clone local git repositories to. |
| 149 | ``git_dir=/var/lib/zuul/git`` |
| 150 | |
Paul Belanger | b67aba1 | 2013-05-13 19:22:14 -0400 | [diff] [blame] | 151 | **git_user_email** |
| 152 | Optional: Value to pass to `git config user.email`. |
| 153 | ``git_user_email=zuul@example.com`` |
| 154 | |
| 155 | **git_user_name** |
| 156 | Optional: Value to pass to `git config user.name`. |
| 157 | ``git_user_name=zuul`` |
| 158 | |
Arx Cruz | b1b010d | 2013-10-28 19:49:59 -0200 | [diff] [blame] | 159 | **zuul_url** |
James E. Blair | 4076e2b | 2014-01-28 12:42:20 -0800 | [diff] [blame] | 160 | URL of this merger's git repos, accessible to test workers. Usually |
| 161 | "http://zuul.example.com/p" or "http://zuul-merger01.example.com/p" |
| 162 | depending on whether the merger is co-located with the Zuul server. |
Arx Cruz | b1b010d | 2013-10-28 19:49:59 -0200 | [diff] [blame] | 163 | |
James E. Blair | a443013 | 2014-02-17 08:32:07 -0800 | [diff] [blame] | 164 | **log_config** |
| 165 | Path to log config file for the merger process. |
| 166 | ``log_config=/etc/zuul/logging.yaml`` |
| 167 | |
| 168 | **pidfile** |
| 169 | Path to PID lock file for the merger process. |
| 170 | ``pidfile=/var/run/zuul-merger/merger.pid`` |
| 171 | |
David Shrewsbury | e737420 | 2017-04-27 12:28:45 -0400 | [diff] [blame] | 172 | executor |
| 173 | """""""" |
| 174 | |
| 175 | The zuul-executor process configuration. |
| 176 | |
| 177 | **git_dir** |
| 178 | Directory that Zuul should clone local git repositories to. |
| 179 | ``git_dir=/var/lib/zuul/git`` |
| 180 | |
| 181 | **log_config** |
| 182 | Path to log config file for the executor process. |
| 183 | ``log_config=/etc/zuul/logging.yaml`` |
| 184 | |
| 185 | **private_key_file** |
| 186 | SSH private key file to be used when logging into worker nodes. |
| 187 | ``private_key_file=~/.ssh/id_rsa`` |
| 188 | |
| 189 | **user** |
| 190 | User ID for the zuul-executor process. In normal operation as a daemon, |
| 191 | the executor should be started as the ``root`` user, but it will drop |
| 192 | privileges to this user during startup. |
| 193 | ``user=zuul`` |
| 194 | |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 195 | .. _connection: |
| 196 | |
| 197 | connection ArbitraryName |
| 198 | """""""""""""""""""""""" |
| 199 | |
| 200 | A connection can be listed with any arbitrary name. The required |
| 201 | parameters are specified in the :ref:`connections` documentation |
| 202 | depending on what driver you are using. |
| 203 | |
| 204 | .. _layoutyaml: |
| 205 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 206 | layout.yaml |
| 207 | ~~~~~~~~~~~ |
| 208 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 209 | 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] | 210 | and projects are defined, what tests should be run, and what actions |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 211 | Zuul should perform. There are three sections: pipelines, jobs, and |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 212 | projects. |
| 213 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 214 | Pipelines |
| 215 | """"""""" |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 216 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 217 | Zuul can have any number of independent pipelines. Whenever a matching |
| 218 | Gerrit event is found for a pipeline, that event is added to the |
| 219 | pipeline, and the jobs specified for that pipeline are run. When all |
| 220 | jobs specified for the pipeline that were triggered by an event are |
| 221 | completed, Zuul reports back to Gerrit the results. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 222 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 223 | There are no pre-defined pipelines in Zuul, rather you can define |
| 224 | whatever pipelines you need in the layout file. This is a very flexible |
| 225 | system that can accommodate many kinds of workflows. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 226 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 227 | 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] | 228 | explanation of each of the parameters:: |
| 229 | |
| 230 | - name: check |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 231 | manager: IndependentPipelineManager |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 232 | source: my_gerrit |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 233 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 234 | my_gerrit: |
James E. Blair | 6c358e7 | 2013-07-29 17:06:47 -0700 | [diff] [blame] | 235 | - event: patchset-created |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 236 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 237 | my_gerrit: |
| 238 | verified: 1 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 239 | failure: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 240 | my_gerrit |
| 241 | verified: -1 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 242 | |
| 243 | **name** |
| 244 | This is used later in the project definition to indicate what jobs |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 245 | should be run for events in the pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 246 | |
James E. Blair | 8dbd56a | 2012-12-22 10:55:10 -0800 | [diff] [blame] | 247 | **description** |
| 248 | This is an optional field that may be used to provide a textual |
| 249 | description of the pipeline. |
| 250 | |
James E. Blair | c0dedf8 | 2014-08-06 09:37:52 -0700 | [diff] [blame] | 251 | **source** |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 252 | A required field that specifies a connection that provides access to |
| 253 | the change objects that this pipeline operates on. The name of the |
| 254 | connection as per the zuul.conf should be specified. The driver used |
| 255 | for the connection named will be the source. Currently only ``gerrit`` |
| 256 | drivers are supported. |
James E. Blair | c0dedf8 | 2014-08-06 09:37:52 -0700 | [diff] [blame] | 257 | |
James E. Blair | 5637019 | 2013-01-14 15:47:28 -0800 | [diff] [blame] | 258 | **success-message** |
| 259 | An optional field that supplies the introductory text in message |
| 260 | reported back to Gerrit when all the voting builds are successful. |
| 261 | Defaults to "Build successful." |
| 262 | |
| 263 | **failure-message** |
| 264 | An optional field that supplies the introductory text in message |
| 265 | reported back to Gerrit when at least one voting build fails. |
| 266 | Defaults to "Build failed." |
| 267 | |
Joshua Hesketh | b717977 | 2014-01-30 23:30:46 +1100 | [diff] [blame] | 268 | **merge-failure-message** |
| 269 | An optional field that supplies the introductory text in message |
| 270 | reported back to Gerrit when a change fails to merge with the |
| 271 | current state of the repository. |
| 272 | Defaults to "Merge failed." |
| 273 | |
Joshua Hesketh | 3979e3e | 2014-03-04 11:21:10 +1100 | [diff] [blame] | 274 | **footer-message** |
| 275 | An optional field to supply additional information after test results. |
| 276 | Useful for adding information about the CI system such as debugging |
| 277 | and contact details. |
| 278 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 279 | **manager** |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 280 | There are currently two schemes for managing pipelines: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 281 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 282 | *IndependentPipelineManager* |
| 283 | Every event in this pipeline should be treated as independent of |
| 284 | other events in the pipeline. This is appropriate when the order of |
| 285 | events in the pipeline doesn't matter because the results of the |
| 286 | actions this pipeline performs can not affect other events in the |
| 287 | pipeline. For example, when a change is first uploaded for review, |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 288 | you may want to run tests on that change to provide early feedback |
| 289 | to reviewers. At the end of the tests, the change is not going to |
| 290 | 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] | 291 | regard to any other changes in the pipeline. They are independent. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 292 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 293 | Another type of pipeline that is independent is a post-merge |
| 294 | pipeline. In that case, the changes have already merged, so the |
| 295 | results can not affect any other events in the pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 296 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 297 | *DependentPipelineManager* |
| 298 | The dependent pipeline manager is designed for gating. It ensures |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 299 | that every change is tested exactly as it is going to be merged |
| 300 | into the repository. An ideal gating system would test one change |
| 301 | at a time, applied to the tip of the repository, and only if that |
| 302 | change passed tests would it be merged. Then the next change in |
| 303 | line would be tested the same way. In order to achieve parallel |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 304 | testing of changes, the dependent pipeline manager performs |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 305 | speculative execution on changes. It orders changes based on |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 306 | their entry into the pipeline. It begins testing all changes in |
| 307 | parallel, assuming that each change ahead in the pipeline will pass |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 308 | 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] | 309 | merged in parallel. If a change near the front of the pipeline |
| 310 | fails its tests, each change behind it ignores whatever tests have |
| 311 | been completed and are tested again without the change in front. |
| 312 | This way gate tests may run in parallel but still be tested |
| 313 | correctly, exactly as they will appear in the repository when |
| 314 | merged. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 315 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 316 | One important characteristic of the DependentPipelineManager is that |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 317 | it analyzes the jobs that are triggered by different projects, and |
| 318 | if those projects have jobs in common, it treats those projects as |
| 319 | related, and they share a single virtual queue of changes. Thus, |
| 320 | if there is a job that performs integration testing on two |
| 321 | projects, those two projects will automatically share a virtual |
| 322 | change queue. If a third project does not invoke that job, it |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 323 | will be part of a separate virtual change queue, and changes to |
| 324 | it will not depend on changes to the first two jobs. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 325 | |
| 326 | For more detail on the theory and operation of Zuul's |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 327 | DependentPipelineManager, see: :doc:`gating`. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 328 | |
| 329 | **trigger** |
James E. Blair | c494d54 | 2014-08-06 09:23:52 -0700 | [diff] [blame] | 330 | At least one trigger source must be supplied for each pipeline. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 331 | Triggers are not exclusive -- matching events may be placed in |
James E. Blair | 6c358e7 | 2013-07-29 17:06:47 -0700 | [diff] [blame] | 332 | multiple pipelines, and they will behave independently in each of |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 333 | the pipelines they match. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 334 | |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 335 | Triggers are loaded from their connection name. The driver type of |
| 336 | the connection will dictate which options are available. |
| 337 | See :doc:`triggers`. |
James E. Blair | c494d54 | 2014-08-06 09:23:52 -0700 | [diff] [blame] | 338 | |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 339 | **require** |
| 340 | If this section is present, it established pre-requisites for any |
| 341 | kind of item entering the Pipeline. Regardless of how the item is |
| 342 | to be enqueued (via any trigger or automatic dependency resolution), |
| 343 | the conditions specified here must be met or the item will not be |
| 344 | enqueued. |
| 345 | |
Antoine Musso | 27ab0d5 | 2014-10-22 14:20:17 +0200 | [diff] [blame] | 346 | .. _pipeline-require-approval: |
| 347 | |
James E. Blair | 5bf78a3 | 2015-07-30 18:08:24 +0000 | [diff] [blame] | 348 | **approval** |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 349 | This requires that a certain kind of approval be present for the |
| 350 | current patchset of the change (the approval could be added by the |
| 351 | event in question). It takes several sub-parameters, all of which |
| 352 | are optional and are combined together so that there must be an |
| 353 | approval matching all specified requirements. |
| 354 | |
| 355 | *username* |
James E. Blair | b01ec54 | 2016-06-16 09:46:49 -0700 | [diff] [blame] | 356 | If present, an approval from this username is required. It is |
| 357 | treated as a regular expression. |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 358 | |
James E. Blair | 1fbfceb | 2014-06-23 14:42:53 -0700 | [diff] [blame] | 359 | *email* |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 360 | If present, an approval with this email address is required. It |
James E. Blair | b01ec54 | 2016-06-16 09:46:49 -0700 | [diff] [blame] | 361 | is treated as a regular expression. |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 362 | |
James E. Blair | 1fbfceb | 2014-06-23 14:42:53 -0700 | [diff] [blame] | 363 | *email-filter* (deprecated) |
| 364 | A deprecated alternate spelling of *email*. Only one of *email* or |
| 365 | *email_filter* should be used. |
| 366 | |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 367 | *older-than* |
| 368 | If present, the approval must be older than this amount of time |
| 369 | to match. Provide a time interval as a number with a suffix of |
| 370 | "w" (weeks), "d" (days), "h" (hours), "m" (minutes), "s" |
| 371 | (seconds). Example ``48h`` or ``2d``. |
| 372 | |
| 373 | *newer-than* |
| 374 | If present, the approval must be newer than this amount of time |
| 375 | to match. Same format as "older-than". |
| 376 | |
| 377 | Any other field is interpreted as a review category and value |
| 378 | pair. For example ``verified: 1`` would require that the approval |
James E. Blair | 9c17dbf | 2014-06-23 14:21:58 -0700 | [diff] [blame] | 379 | be for a +1 vote in the "Verified" column. The value may either |
| 380 | be a single value or a list: ``verified: [1, 2]`` would match |
| 381 | either a +1 or +2 vote. |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 382 | |
| 383 | **open** |
| 384 | A boolean value (``true`` or ``false``) that indicates whether the change |
| 385 | must be open or closed in order to be enqueued. |
| 386 | |
Clark Boylan | a9702ad | 2014-05-08 17:17:24 -0700 | [diff] [blame] | 387 | **current-patchset** |
| 388 | A boolean value (``true`` or ``false``) that indicates whether the change |
| 389 | must be the current patchset in order to be enqueued. |
| 390 | |
James E. Blair | 11041d2 | 2014-05-02 14:49:53 -0700 | [diff] [blame] | 391 | **status** |
| 392 | A string value that corresponds with the status of the change |
| 393 | reported by the trigger. For example, when using the Gerrit |
| 394 | trigger, status values such as ``NEW`` or ``MERGED`` may be useful. |
James E. Blair | 63bb0ef | 2013-07-29 17:14:51 -0700 | [diff] [blame] | 395 | |
Joshua Hesketh | 66c8e52 | 2014-06-26 15:30:08 +1000 | [diff] [blame] | 396 | **reject** |
| 397 | If this section is present, it establishes pre-requisites that can |
| 398 | block an item from being enqueued. It can be considered a negative |
| 399 | version of **require**. |
| 400 | |
| 401 | **approval** |
| 402 | This takes a list of approvals. If an approval matches the provided |
| 403 | criteria the change can not be entered into the pipeline. It follows |
| 404 | the same syntax as the :ref:`"require approval" pipeline above |
| 405 | <pipeline-require-approval>`. |
| 406 | |
| 407 | Example to reject a change with any negative vote:: |
| 408 | |
| 409 | reject: |
| 410 | approval: |
| 411 | - code-review: [-1, -2] |
| 412 | |
James E. Blair | 2fa5096 | 2013-01-30 21:50:41 -0800 | [diff] [blame] | 413 | **dequeue-on-new-patchset** |
| 414 | Normally, if a new patchset is uploaded to a change that is in a |
| 415 | pipeline, the existing entry in the pipeline will be removed (with |
| 416 | jobs canceled and any dependent changes that can no longer merge as |
| 417 | well. To suppress this behavior (and allow jobs to continue |
| 418 | running), set this to ``false``. Default: ``true``. |
| 419 | |
James E. Blair | 17dd677 | 2015-02-09 14:45:18 -0800 | [diff] [blame] | 420 | **ignore-dependencies** |
| 421 | In any kind of pipeline (dependent or independent), Zuul will |
| 422 | attempt to enqueue all dependencies ahead of the current change so |
| 423 | that they are tested together (independent pipelines report the |
| 424 | results of each change regardless of the results of changes ahead). |
| 425 | To ignore dependencies completely in an independent pipeline, set |
| 426 | this to ``true``. This option is ignored by dependent pipelines. |
| 427 | The default is: ``false``. |
| 428 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 429 | **success** |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 430 | Describes where Zuul should report to if all the jobs complete |
| 431 | successfully. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 432 | This section is optional; if it is omitted, Zuul will run jobs and |
| 433 | do nothing on success; it will not even report a message to Gerrit. |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 434 | If the section is present, the listed reporter plugins will be |
| 435 | asked to report on the jobs. |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 436 | The reporters are listed by their connection name. The options |
| 437 | available depend on the driver for the supplied connection. |
| 438 | See :doc:`reporters` for more details. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 439 | |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 440 | **failure** |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 441 | Uses the same syntax as **success**, but describes what Zuul should |
| 442 | do if at least one job fails. |
James E. Blair | dc25386 | 2012-06-13 17:12:42 -0700 | [diff] [blame] | 443 | |
Joshua Hesketh | b717977 | 2014-01-30 23:30:46 +1100 | [diff] [blame] | 444 | **merge-failure** |
| 445 | Uses the same syntax as **success**, but describes what Zuul should |
| 446 | do if it is unable to merge in the patchset. If no merge-failure |
| 447 | reporters are listed then the ``failure`` reporters will be used to |
| 448 | notify of unsuccessful merges. |
| 449 | |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 450 | **start** |
James E. Blair | dc25386 | 2012-06-13 17:12:42 -0700 | [diff] [blame] | 451 | Uses the same syntax as **success**, but describes what Zuul should |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 452 | 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] | 453 | for example, to reset the value of the Verified review category. |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 454 | |
Joshua Hesketh | 89e829d | 2015-02-10 16:29:45 +1100 | [diff] [blame] | 455 | **disabled** |
| 456 | Uses the same syntax as **success**, but describes what Zuul should |
| 457 | do when a pipeline is disabled. |
| 458 | See ``disable-after-consecutive-failures``. |
| 459 | |
| 460 | **disable-after-consecutive-failures** |
| 461 | If set, a pipeline can enter a ''disabled'' state if too many changes |
| 462 | in a row fail. When this value is exceeded the pipeline will stop |
| 463 | reporting to any of the ``success``, ``failure`` or ``merge-failure`` |
| 464 | reporters and instead only report to the ``disabled`` reporters. |
| 465 | (No ``start`` reports are made when a pipeline is disabled). |
| 466 | |
James E. Blair | 64ed6f2 | 2013-07-10 14:07:23 -0700 | [diff] [blame] | 467 | **precedence** |
| 468 | Indicates how the build scheduler should prioritize jobs for |
| 469 | different pipelines. Each pipeline may have one precedence, jobs |
| 470 | for pipelines with a higher precedence will be run before ones with |
| 471 | lower. The value should be one of ``high``, ``normal``, or ``low``. |
| 472 | Default: ``normal``. |
| 473 | |
Clark Boylan | c2d19e4 | 2014-01-23 14:08:58 -0800 | [diff] [blame] | 474 | **window** |
| 475 | DependentPipelineManagers only. Zuul can rate limit |
| 476 | DependentPipelineManagers in a manner similar to TCP flow control. |
| 477 | Jobs are only started for changes in the queue if they sit in the |
| 478 | actionable window for the pipeline. The initial length of this window |
| 479 | is configurable with this value. The value given should be a positive |
| 480 | integer value. A value of ``0`` disables rate limiting on the |
| 481 | DependentPipelineManager. |
| 482 | Default: ``20``. |
| 483 | |
| 484 | **window-floor** |
| 485 | DependentPipelineManagers only. This is the minimum value for the |
| 486 | window described above. Should be a positive non zero integer value. |
| 487 | Default: ``3``. |
| 488 | |
| 489 | **window-increase-type** |
| 490 | DependentPipelineManagers only. This value describes how the window |
| 491 | should grow when changes are successfully merged by zuul. A value of |
| 492 | ``linear`` indicates that ``window-increase-factor`` should be added |
| 493 | to the previous window value. A value of ``exponential`` indicates |
| 494 | that ``window-increase-factor`` should be multiplied against the |
| 495 | previous window value and the result will become the window size. |
| 496 | Default: ``linear``. |
| 497 | |
| 498 | **window-increase-factor** |
Clint Adams | 041ae51 | 2015-06-16 20:02:29 -0400 | [diff] [blame] | 499 | DependentPipelineManagers only. The value to be added or multiplied |
Clark Boylan | c2d19e4 | 2014-01-23 14:08:58 -0800 | [diff] [blame] | 500 | against the previous window value to determine the new window after |
| 501 | successful change merges. |
| 502 | Default: ``1``. |
| 503 | |
| 504 | **window-decrease-type** |
| 505 | DependentPipelineManagers only. This value describes how the window |
| 506 | should shrink when changes are not able to be merged by Zuul. A value |
| 507 | of ``linear`` indicates that ``window-decrease-factor`` should be |
| 508 | subtracted from the previous window value. A value of ``exponential`` |
| 509 | indicates that ``window-decrease-factor`` should be divided against |
| 510 | the previous window value and the result will become the window size. |
| 511 | Default: ``exponential``. |
| 512 | |
| 513 | **window-decrease-factor** |
| 514 | DependentPipelineManagers only. The value to be subtracted or divided |
| 515 | against the previous window value to determine the new window after |
| 516 | unsuccessful change merges. |
| 517 | Default: ``2``. |
| 518 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 519 | Some example pipeline configurations are included in the sample layout |
| 520 | file. The first is called a *check* pipeline:: |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 521 | |
| 522 | - name: check |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 523 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 524 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 525 | my_gerrit: |
| 526 | - event: patchset-created |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 527 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 528 | my_gerrit: |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 529 | verified: 1 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 530 | failure: |
Thomas Bechtold | a8c0dbd | 2015-12-10 07:16:54 +0100 | [diff] [blame] | 531 | my_gerrit: |
| 532 | verified: -1 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 533 | |
| 534 | This will trigger jobs each time a new patchset (or change) is |
| 535 | uploaded to Gerrit, and report +/-1 values to Gerrit in the |
| 536 | ``verified`` review category. :: |
| 537 | |
| 538 | - name: gate |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 539 | manager: DependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 540 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 541 | my_gerrit: |
| 542 | - event: comment-added |
| 543 | approval: |
| 544 | - approved: 1 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 545 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 546 | my_gerrit: |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 547 | verified: 2 |
| 548 | submit: true |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 549 | failure: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 550 | my_gerrit: |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 551 | verified: -2 |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 552 | |
| 553 | This will trigger jobs whenever a reviewer leaves a vote of ``1`` in the |
| 554 | ``approved`` review category in Gerrit (a non-standard category). |
| 555 | Changes will be tested in such a way as to guarantee that they will be |
| 556 | merged exactly as tested, though that will happen in parallel by |
| 557 | creating a virtual queue of dependent changes and performing |
| 558 | speculative execution of jobs. :: |
| 559 | |
| 560 | - name: post |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 561 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 562 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 563 | my_gerrit: |
| 564 | - event: ref-updated |
| 565 | ref: ^(?!refs/).*$ |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 566 | |
| 567 | This will trigger jobs whenever a change is merged to a named branch |
| 568 | (e.g., ``master``). No output will be reported to Gerrit. This is |
| 569 | useful for side effects such as creating per-commit tarballs. :: |
| 570 | |
| 571 | - name: silent |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 572 | manager: IndependentPipelineManager |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 573 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 574 | my_gerrit: |
| 575 | - event: patchset-created |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 576 | |
| 577 | This also triggers jobs when changes are uploaded to Gerrit, but no |
| 578 | 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] | 579 | development and not yet ready to be presented to developers. :: |
| 580 | |
| 581 | pipelines: |
| 582 | - name: post-merge |
| 583 | manager: IndependentPipelineManager |
| 584 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 585 | my_gerrit: |
| 586 | - event: change-merged |
Antoine Musso | ce33384 | 2012-10-16 14:42:35 +0200 | [diff] [blame] | 587 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 588 | my_gerrit: |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 589 | force-message: True |
Antoine Musso | ce33384 | 2012-10-16 14:42:35 +0200 | [diff] [blame] | 590 | failure: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 591 | my_gerrit: |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 592 | force-message: True |
Antoine Musso | ce33384 | 2012-10-16 14:42:35 +0200 | [diff] [blame] | 593 | |
| 594 | The ``change-merged`` events happen when a change has been merged in the git |
| 595 | repository. The change is thus closed and Gerrit will not accept modifications |
| 596 | to the review scoring such as ``code-review`` or ``verified``. By using the |
| 597 | ``force-message: True`` parameter, Zuul will pass ``--force-message`` to the |
| 598 | ``gerrit review`` command, thus making sure the message is actually |
| 599 | sent back to Gerrit regardless of approval scores. |
| 600 | That kind of pipeline is nice to run regression or performance tests. |
| 601 | |
| 602 | .. note:: |
| 603 | The ``change-merged`` event does not include the commit sha1 which can be |
| 604 | hazardous, it would let you report back to Gerrit though. If you were to |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 605 | build a tarball for a specific commit, you should consider instead using |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 606 | the ``ref-updated`` event which does include the commit sha1 (but lacks the |
Antoine Musso | ce33384 | 2012-10-16 14:42:35 +0200 | [diff] [blame] | 607 | Gerrit change number). |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 608 | |
Joshua Hesketh | 36c3fa5 | 2014-01-22 11:40:52 +1100 | [diff] [blame] | 609 | |
| 610 | .. _jobs: |
| 611 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 612 | Jobs |
| 613 | """" |
| 614 | |
| 615 | The jobs section is optional, and can be used to set attributes of |
| 616 | jobs that are independent of their association with a project. For |
| 617 | example, if a job should return a customized message on failure, that |
| 618 | may be specified here. Otherwise, Zuul does not need to be told about |
| 619 | each job as it builds a list from the project specification. |
| 620 | |
| 621 | **name** |
| 622 | The name of the job. This field is treated as a regular expression |
| 623 | and will be applied to each job that matches. |
| 624 | |
James E. Blair | c8a1e05 | 2014-02-25 09:29:26 -0800 | [diff] [blame] | 625 | **queue-name (optional)** |
| 626 | Zuul will automatically combine projects that share a job into |
| 627 | shared change queues for dependent pipeline managers. In order to |
| 628 | report statistics about these queues, it is convenient for them to |
| 629 | have names. Zuul can automatically name change queues, however |
| 630 | these can grow quite long and are prone to changing as projects in |
| 631 | the queue change. If you assign a queue-name to a job, Zuul will |
| 632 | use that as the name for the shared change queue that contains that |
| 633 | job instead of the automatically generated one. It is an error for |
| 634 | a shared change queue to have more than one job with a queue-name if |
| 635 | they are not the same. |
| 636 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 637 | **failure-message (optional)** |
| 638 | 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] | 639 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 640 | **success-message (optional)** |
| 641 | 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] | 642 | |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 643 | **failure-pattern (optional)** |
| 644 | The URL that should be reported to Gerrit if the job fails. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 645 | Defaults to the build URL or the url_pattern configured in |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 646 | zuul.conf. May be supplied as a string pattern with substitutions |
| 647 | as described in url_pattern in :ref:`zuulconf`. |
| 648 | |
| 649 | **success-pattern (optional)** |
| 650 | The URL that should be reported to Gerrit if the job succeeds. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 651 | Defaults to the build URL or the url_pattern configured in |
James E. Blair | 6aea36d | 2012-12-17 13:03:24 -0800 | [diff] [blame] | 652 | zuul.conf. May be supplied as a string pattern with substitutions |
| 653 | as described in url_pattern in :ref:`zuulconf`. |
| 654 | |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 655 | **hold-following-changes (optional)** |
| 656 | This is a boolean that indicates that changes that follow this |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 657 | change in a dependent change pipeline should wait until this job |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 658 | succeeds before executing. If this is applied to a very short job |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 659 | that can predict whether longer jobs will fail early, this can be |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 660 | used to reduce the number of jobs that Zuul will execute and |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 661 | ultimately have to cancel. In that case, a small amount of |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 662 | parallelization of jobs is traded for more efficient use of testing |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 663 | resources. On the other hand, to apply this to a long running job |
| 664 | would largely defeat the parallelization of dependent change testing |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 665 | that is the main feature of Zuul. Default: ``false``. |
James E. Blair | 222d498 | 2012-07-16 09:31:19 -0700 | [diff] [blame] | 666 | |
Tobias Henkel | 9a0e194 | 2017-03-20 16:16:02 +0100 | [diff] [blame] | 667 | **semaphore (optional)** |
| 668 | This is a string that names a semaphore that should be observed by this |
| 669 | job. The semaphore defines how many jobs which reference that semaphore |
| 670 | can be enqueued at a time. This applies across all pipelines in the same |
| 671 | tenant. The max value of the semaphore can be specified in the config |
| 672 | repositories and defaults to 1. |
James E. Blair | af17a97 | 2016-02-03 15:07:18 -0800 | [diff] [blame] | 673 | |
James E. Blair | e5a847f | 2012-07-10 15:29:14 -0700 | [diff] [blame] | 674 | **branch (optional)** |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 675 | This job should only be run on matching branches. This field is |
| 676 | treated as a regular expression and multiple branches may be |
| 677 | listed. |
| 678 | |
James E. Blair | 70c7158 | 2013-03-06 08:50:50 -0800 | [diff] [blame] | 679 | **files (optional)** |
| 680 | This job should only be run if at least one of the files involved in |
| 681 | the change (added, deleted, or modified) matches at least one of the |
| 682 | file patterns listed here. This field is treated as a regular |
| 683 | expression and multiple expressions may be listed. |
| 684 | |
Maru Newby | 3fe5f85 | 2015-01-13 04:22:14 +0000 | [diff] [blame] | 685 | **skip-if (optional)** |
| 686 | |
| 687 | This job should not be run if all the patterns specified by the |
| 688 | optional fields listed below match on their targets. When multiple |
| 689 | sets of parameters are provided, this job will be skipped if any set |
| 690 | matches. For example: :: |
| 691 | |
| 692 | jobs: |
| 693 | - name: check-tempest-dsvm-neutron |
| 694 | skip-if: |
| 695 | - project: ^openstack/neutron$ |
| 696 | branch: ^stable/juno$ |
| 697 | all-files-match-any: |
| 698 | - ^neutron/tests/.*$ |
| 699 | - ^tools/.*$ |
| 700 | - all-files-match-any: |
| 701 | - ^doc/.*$ |
| 702 | - ^.*\.rst$ |
| 703 | |
| 704 | With this configuration, the job would be skipped for a neutron |
| 705 | patchset for the stable/juno branch provided that every file in the |
| 706 | change matched at least one of the specified file regexes. The job |
| 707 | will also be skipped for any patchset that modified only the doc |
| 708 | tree or rst files. |
| 709 | |
| 710 | *project* (optional) |
| 711 | The regular expression to match against the project of the change. |
| 712 | |
| 713 | *branch* (optional) |
| 714 | The regular expression to match against the branch or ref of the |
| 715 | change. |
| 716 | |
| 717 | *all-files-match-any* (optional) |
| 718 | A list of regular expressions intended to match the files involved |
| 719 | in the change. This parameter will be considered matching a |
| 720 | change only if all files in a change match at least one of these |
| 721 | expressions. |
| 722 | |
| 723 | The pattern for '/COMMIT_MSG' is always matched on and does not |
Alexander Evseev | dbe6fab | 2015-11-19 12:46:34 +0300 | [diff] [blame] | 724 | have to be included. Exception is merge commits (without modified |
| 725 | files), in this case '/COMMIT_MSG' is not matched, and job is not |
| 726 | skipped. In case of merge commits it's assumed that list of modified |
| 727 | files isn't predictible and CI should be run. |
Maru Newby | 3fe5f85 | 2015-01-13 04:22:14 +0000 | [diff] [blame] | 728 | |
Mathieu Gagné | d6d2a64 | 2013-06-11 20:59:58 -0400 | [diff] [blame] | 729 | **voting (optional)** |
| 730 | Boolean value (``true`` or ``false``) that indicates whatever |
| 731 | a job is voting or not. Default: ``true``. |
| 732 | |
Paul Belanger | 71d9817 | 2016-11-08 10:56:31 -0500 | [diff] [blame] | 733 | **attempts (optional)** |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 734 | Number of attempts zuul will execute a job. Once reached, zuul will report |
Paul Belanger | 71d9817 | 2016-11-08 10:56:31 -0500 | [diff] [blame] | 735 | RETRY_LIMIT as the job result. |
| 736 | Defaults to 3. |
| 737 | |
James E. Blair | 456f2fb | 2016-02-09 09:29:33 -0800 | [diff] [blame] | 738 | **tags (optional)** |
| 739 | A list of arbitrary strings which will be associated with the job. |
James E. Blair | 1f4c2bb | 2013-04-26 08:40:46 -0700 | [diff] [blame] | 740 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 741 | Here is an example of setting the failure message for jobs that check |
| 742 | whether a change merges cleanly:: |
| 743 | |
| 744 | - name: ^.*-merge$ |
Jeremy Stanley | 1c2c3c2 | 2015-06-15 21:23:19 +0000 | [diff] [blame] | 745 | failure-message: This change or one of its cross-repo dependencies |
| 746 | was unable to be automatically merged with the current state of |
| 747 | its repository. Please rebase the change and upload a new |
| 748 | patchset. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 749 | |
| 750 | Projects |
| 751 | """""""" |
| 752 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 753 | 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] | 754 | for events associated with each project. It contains a list of |
| 755 | projects. Here is an example:: |
| 756 | |
| 757 | - name: example/project |
| 758 | check: |
| 759 | - project-merge: |
| 760 | - project-unittest |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 761 | - project-pep8 |
| 762 | - project-pyflakes |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 763 | gate: |
| 764 | - project-merge: |
| 765 | - project-unittest |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 766 | - project-pep8 |
| 767 | - project-pyflakes |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 768 | post: |
| 769 | - project-publish |
| 770 | |
| 771 | **name** |
| 772 | The name of the project (as known by Gerrit). |
| 773 | |
James E. Blair | 19deff2 | 2013-08-25 13:17:35 -0700 | [diff] [blame] | 774 | **merge-mode (optional)** |
| 775 | An optional value that indicates what strategy should be used to |
| 776 | merge changes to this project. Supported values are: |
| 777 | |
| 778 | ** merge-resolve ** |
| 779 | Equivalent to 'git merge -s resolve'. This corresponds closely to |
| 780 | what Gerrit performs (using JGit) for a project if the "Merge if |
| 781 | necessary" merge mode is selected and "Automatically resolve |
| 782 | conflicts" is checked. This is the default. |
| 783 | |
| 784 | ** merge ** |
| 785 | Equivalent to 'git merge'. |
| 786 | |
| 787 | ** cherry-pick ** |
| 788 | Equivalent to 'git cherry-pick'. |
| 789 | |
Clark Boylan | 00635dc | 2012-09-19 14:03:08 -0700 | [diff] [blame] | 790 | This is followed by a section for each of the pipelines defined above. |
| 791 | Pipelines may be omitted if no jobs should run for this project in a |
| 792 | given pipeline. Within the pipeline section, the jobs that should be |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 793 | executed are listed. If a job is entered as a dictionary key, then |
| 794 | jobs contained within that key are only executed if the key job |
| 795 | succeeds. In the above example, project-unittest, project-pep8, and |
Fredrik Medley | f8aec83 | 2015-09-28 13:40:20 +0200 | [diff] [blame] | 796 | project-pyflakes are only executed if project-merge succeeds. |
| 797 | Furthermore, project-finaltest is executed only if project-unittest, |
| 798 | project-pep8 and project-pyflakes all succeed. This can help avoid |
| 799 | running unnecessary jobs while maximizing parallelism. It is also |
| 800 | useful when distributing results between jobs. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 801 | |
James E. Blair | 18c6444 | 2014-03-18 10:14:45 -0700 | [diff] [blame] | 802 | The special job named ``noop`` is internal to Zuul and will always |
| 803 | return ``SUCCESS`` immediately. This can be useful if you require |
| 804 | that all changes be processed by a pipeline but a project has no jobs |
| 805 | that can be run on it. |
| 806 | |
Andreas Jaeger | bcfbf93 | 2014-09-29 20:21:44 +0200 | [diff] [blame] | 807 | .. seealso:: The OpenStack Zuul configuration for a comprehensive example: https://git.openstack.org/cgit/openstack-infra/project-config/tree/zuul/layout.yaml |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 808 | |
Antoine Musso | 80edd5a | 2013-02-13 15:37:53 +0100 | [diff] [blame] | 809 | Project Templates |
| 810 | """"""""""""""""" |
| 811 | |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 812 | Whenever you have lot of similar projects (such as plugins for a project) you |
Antoine Musso | 80edd5a | 2013-02-13 15:37:53 +0100 | [diff] [blame] | 813 | will most probably want to use the same pipeline configurations. The |
| 814 | project templates let you define pipelines and job name templates to trigger. |
| 815 | One can then just apply the template on its project which make it easier to |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 816 | update several similar projects. As an example:: |
Antoine Musso | 80edd5a | 2013-02-13 15:37:53 +0100 | [diff] [blame] | 817 | |
| 818 | project-templates: |
| 819 | # Name of the template |
| 820 | - name: plugin-triggering |
| 821 | # Definition of pipelines just like for a `project` |
| 822 | check: |
| 823 | - '{jobprefix}-merge': |
| 824 | - '{jobprefix}-pep8' |
| 825 | - '{jobprefix}-pyflakes' |
| 826 | gate: |
| 827 | - '{jobprefix}-merge': |
| 828 | - '{jobprefix}-unittest' |
| 829 | - '{jobprefix}-pep8' |
| 830 | - '{jobprefix}-pyflakes' |
| 831 | |
| 832 | In your projects definition, you will then apply the template using the template |
| 833 | key:: |
| 834 | |
| 835 | projects: |
| 836 | - name: plugin/foobar |
| 837 | template: |
| 838 | - name: plugin-triggering |
| 839 | jobprefix: plugin-foobar |
| 840 | |
James E. Blair | aea6cf6 | 2013-12-16 15:38:12 -0800 | [diff] [blame] | 841 | You can pass several parameters to a template. A ``parameter`` value |
| 842 | will be used for expansion of ``{parameter}`` in the template |
| 843 | strings. The parameter ``name`` will be automatically provided and |
| 844 | will contain the short name of the project, that is the portion of the |
| 845 | project name after the last ``/`` character. |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 846 | |
James E. Blair | 3e98c02 | 2013-12-16 15:25:38 -0800 | [diff] [blame] | 847 | Multiple templates can be combined in a project, and the jobs from all |
| 848 | of those templates will be added to the project. Individual jobs may |
| 849 | also be added:: |
| 850 | |
| 851 | projects: |
| 852 | - name: plugin/foobar |
| 853 | template: |
| 854 | - name: plugin-triggering |
| 855 | jobprefix: plugin-foobar |
| 856 | - name: plugin-extras |
| 857 | jobprefix: plugin-foobar |
| 858 | check: |
| 859 | - foobar-extra-special-job |
| 860 | |
Steven Dake | 21ef9ad | 2014-08-25 23:08:14 -0700 | [diff] [blame] | 861 | Individual jobs may optionally be added to pipelines (e.g. check, |
Atsushi SAKAI | 5d7e93b | 2015-07-28 22:15:48 +0900 | [diff] [blame] | 862 | gate, et cetera) for a project, in addition to those provided by |
Steven Dake | 21ef9ad | 2014-08-25 23:08:14 -0700 | [diff] [blame] | 863 | templates. |
| 864 | |
James E. Blair | 3e98c02 | 2013-12-16 15:25:38 -0800 | [diff] [blame] | 865 | The order of the jobs listed in the project (which only affects the |
| 866 | order of jobs listed on the report) will be the jobs from each |
| 867 | template in the order listed, followed by any jobs individually listed |
| 868 | for the project. |
| 869 | |
| 870 | Note that if multiple templates are used for a project and one |
| 871 | template specifies a job that is also specified in another template, |
James E. Blair | 12a92b1 | 2014-03-26 11:54:53 -0700 | [diff] [blame] | 872 | or specified in the project itself, the configuration defined by |
| 873 | either the last template or the project itself will take priority. |
James E. Blair | 3e98c02 | 2013-12-16 15:25:38 -0800 | [diff] [blame] | 874 | |
Tobias Henkel | 9a0e194 | 2017-03-20 16:16:02 +0100 | [diff] [blame] | 875 | |
| 876 | Semaphores |
| 877 | """""""""" |
| 878 | |
| 879 | When using semaphores the maximum value of each one can be specified in their |
| 880 | respective config repositories. Unspecified semaphores default to 1:: |
| 881 | |
| 882 | - semaphore: |
| 883 | name: semaphore-foo |
| 884 | max: 5 |
| 885 | - semaphore: |
| 886 | name: semaphore-bar |
| 887 | max: 3 |
| 888 | |
| 889 | |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 890 | logging.conf |
| 891 | ~~~~~~~~~~~~ |
| 892 | This file is optional. If provided, it should be a standard |
| 893 | :mod:`logging.config` module configuration file. If not present, Zuul will |
| 894 | output all log messages of DEBUG level or higher to the console. |
| 895 | |
| 896 | Starting Zuul |
| 897 | ------------- |
| 898 | |
| 899 | To start Zuul, run **zuul-server**:: |
| 900 | |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 901 | usage: zuul-server [-h] [-c CONFIG] [-l LAYOUT] [-d] [-t] [--version] |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 902 | |
| 903 | Project gating system. |
| 904 | |
| 905 | optional arguments: |
| 906 | -h, --help show this help message and exit |
| 907 | -c CONFIG specify the config file |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 908 | -l LAYOUT specify the layout file |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 909 | -d do not run as a daemon |
Antoine Musso | b3aa828 | 2013-04-19 15:16:59 +0200 | [diff] [blame] | 910 | -t validate layout file syntax |
| 911 | --version show zuul version |
James E. Blair | cdd0007 | 2012-06-08 19:17:28 -0700 | [diff] [blame] | 912 | |
| 913 | You may want to use the ``-d`` argument while you are initially setting |
| 914 | up Zuul so you can detect any configuration errors quickly. Under |
| 915 | normal operation, omit ``-d`` and let Zuul run as a daemon. |
| 916 | |
| 917 | If you send signal 1 (SIGHUP) to the zuul-server process, Zuul will |
| 918 | stop executing new jobs, wait until all executing jobs are finished, |
Joshua Hesketh | c499715 | 2016-02-17 21:04:18 +1100 | [diff] [blame] | 919 | reload its layout.yaml, and resume. Changes to any connections or |
| 920 | the PID file will be ignored until Zuul is restarted. |
Clark Boylan | f231fa2 | 2013-02-08 12:28:53 -0800 | [diff] [blame] | 921 | |
| 922 | If you send a SIGUSR1 to the zuul-server process, Zuul will stop |
| 923 | executing new jobs, wait until all executing jobs are finished, |
| 924 | then exit. While waiting to exit Zuul will queue Gerrit events and |
| 925 | save these events prior to exiting. When Zuul starts again it will |
| 926 | read these saved events and act on them. |
Jeremy Stanley | 93e05f4 | 2013-03-08 17:29:17 +0000 | [diff] [blame] | 927 | |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 928 | If you need to abort Zuul and intend to manually requeue changes for |
Jeremy Stanley | 93e05f4 | 2013-03-08 17:29:17 +0000 | [diff] [blame] | 929 | jobs which were running in its pipelines, prior to terminating you can |
| 930 | use the zuul-changes.py tool script to simplify the process. For |
Ramy Asselin | dda8e6a | 2015-03-31 14:59:39 -0700 | [diff] [blame] | 931 | example, this would give you a list of zuul-enqueue commands to requeue |
| 932 | changes for the gate and check pipelines respectively:: |
Jeremy Stanley | 93e05f4 | 2013-03-08 17:29:17 +0000 | [diff] [blame] | 933 | |
Ramy Asselin | dda8e6a | 2015-03-31 14:59:39 -0700 | [diff] [blame] | 934 | ./tools/zuul-changes.py http://zuul.openstack.org/ gate |
| 935 | ./tools/zuul-changes.py http://zuul.openstack.org/ check |
Clark Boylan | fba9b24 | 2013-08-20 10:11:17 -0700 | [diff] [blame] | 936 | |
Antoine Musso | 29eab01 | 2014-10-28 21:35:22 +0100 | [diff] [blame] | 937 | If you send a SIGUSR2 to the zuul-server process, or the forked process |
| 938 | that runs the Gearman daemon, Zuul will dump a stack trace for each |
| 939 | running thread into its debug log. It is written under the log bucket |
| 940 | ``zuul.stack_dump``. This is useful for tracking down deadlock or |
| 941 | otherwise slow threads. |
Antoine Musso | d0f0626 | 2014-06-04 09:54:24 +0200 | [diff] [blame] | 942 | |
| 943 | When `yappi <https://code.google.com/p/yappi/>`_ (Yet Another Python |
| 944 | Profiler) is available, additional functions' and threads' stats are |
| 945 | emitted as well. The first SIGUSR2 will enable yappi, on the second |
| 946 | SIGUSR2 it dumps the information collected, resets all yappi state and |
| 947 | stops profiling. This is to minimize the impact of yappi on a running |
| 948 | system. |