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