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