James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 1 | :title: GitHub Driver |
| 2 | |
| 3 | GitHub |
| 4 | ====== |
| 5 | |
| 6 | The GitHub driver supports sources, triggers, and reporters. It can |
| 7 | interact with the public GitHub service as well as site-local |
| 8 | installations of GitHub enterprise. |
| 9 | |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 10 | Configure GitHub |
| 11 | ---------------- |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 12 | |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 13 | There are two options currently available. GitHub's project owner can either |
| 14 | manually setup web-hook or install a GitHub Application. In the first case, |
| 15 | the project's owner needs to know the zuul endpoint and the webhook secrets. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 16 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 17 | |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 18 | Web-Hook |
| 19 | ........ |
| 20 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 21 | To configure a project's `webhook events |
| 22 | <https://developer.github.com/webhooks/creating/>`_: |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 23 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 24 | * Set *Payload URL* to |
| 25 | ``http://<zuul-hostname>/connection/<connection-name>/payload``. |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 26 | |
| 27 | * Set *Content Type* to ``application/json``. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 28 | |
| 29 | Select *Events* you are interested in. See below for the supported events. |
| 30 | |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 31 | You will also need to have a GitHub user created for your zuul: |
| 32 | |
| 33 | * Zuul public key needs to be added to the GitHub account |
| 34 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 35 | * A api_token needs to be created too, see this `article |
| 36 | <https://help.github.com/articles/creating-an-access-token-for-command-line-use/>`_ |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 37 | |
| 38 | Then in the zuul.conf, set webhook_token and api_token. |
| 39 | |
| 40 | Application |
| 41 | ........... |
| 42 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 43 | To create a `GitHub application |
| 44 | <https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/registering-github-apps/>`_: |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 45 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 46 | * Go to your organization settings page to create the application, e.g.: |
| 47 | https://github.com/organizations/my-org/settings/apps/new |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 48 | |
| 49 | * Set GitHub App name to "my-org-zuul" |
| 50 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 51 | * Set Setup URL to your setup documentation, when user install the application |
| 52 | they are redirected to this url |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 53 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 54 | * Set Webhook URL to |
| 55 | ``http://<zuul-hostname>/connection/<connection-name>/payload``. |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 56 | |
| 57 | * Create a Webhook secret |
| 58 | |
| 59 | * Set permissions: |
| 60 | |
| 61 | * Commit statuses: Read & Write |
| 62 | |
| 63 | * Issues: Read & Write |
| 64 | |
| 65 | * Pull requests: Read & Write |
| 66 | |
| 67 | * Repository contents: Read & Write (write to let zuul merge change) |
| 68 | |
| 69 | * Set events subscription: |
| 70 | |
| 71 | * Label |
| 72 | |
| 73 | * Status |
| 74 | |
| 75 | * Issue comment |
| 76 | |
| 77 | * Issues |
| 78 | |
| 79 | * Pull request |
| 80 | |
| 81 | * Pull request review |
| 82 | |
| 83 | * Pull request review comment |
| 84 | |
| 85 | * Commit comment |
| 86 | |
| 87 | * Create |
| 88 | |
| 89 | * Push |
| 90 | |
| 91 | * Release |
| 92 | |
| 93 | * Set Where can this GitHub App be installed to "Any account" |
| 94 | |
| 95 | * Create the App |
| 96 | |
| 97 | * Generate a Private key in the app settings page |
| 98 | |
| 99 | Then in the zuul.conf, set webhook_token, app_id and app_key. |
| 100 | After restarting zuul-scheduler, verify in the 'Advanced' tab that the |
| 101 | Ping payload works (green tick and 200 response) |
| 102 | |
Joshua Hesketh | abac0d0 | 2017-12-11 13:35:56 +1100 | [diff] [blame] | 103 | Users can now install the application using its public page, e.g.: |
| 104 | https://github.com/apps/my-org-zuul |
Tristan Cacqueray | 9d83c61 | 2017-11-23 02:09:53 +0000 | [diff] [blame] | 105 | |
| 106 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 107 | Connection Configuration |
| 108 | ------------------------ |
| 109 | |
Monty Taylor | ae1f03a | 2017-07-27 14:43:32 -0500 | [diff] [blame] | 110 | There are two forms of operation. Either the Zuul installation can be |
| 111 | configured as a `Github App`_ or it can be configured as a Webhook. |
| 112 | |
| 113 | If the `Github App`_ approach is taken, the config settings ``app_id`` and |
| 114 | ``app_key`` are required. If the Webhook approach is taken, the ``api_token`` |
| 115 | setting is required. |
| 116 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 117 | The supported options in ``zuul.conf`` connections are: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 118 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 119 | .. attr:: <github connection> |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 120 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 121 | .. attr:: driver |
| 122 | :required: |
Monty Taylor | ae1f03a | 2017-07-27 14:43:32 -0500 | [diff] [blame] | 123 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 124 | .. value:: github |
Monty Taylor | ae1f03a | 2017-07-27 14:43:32 -0500 | [diff] [blame] | 125 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 126 | The connection must set ``driver=github`` for GitHub connections. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 127 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 128 | .. attr:: app_id |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 129 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 130 | App ID if you are using a *GitHub App*. Can be found under the |
| 131 | **Public Link** on the right hand side labeled **ID**. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 132 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 133 | .. attr:: app_key |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 134 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 135 | Path to a file containing the secret key Zuul will use to create |
| 136 | tokens for the API interactions. In Github this is known as |
| 137 | **Private key** and must be collected when generated. |
James E. Blair | 4d5dd25 | 2017-06-23 21:40:56 +0100 | [diff] [blame] | 138 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 139 | .. attr:: api_token |
| 140 | |
| 141 | API token for accessing GitHub if Zuul is configured with |
| 142 | Webhooks. See `Creating an access token for command-line use |
| 143 | <https://help.github.com/articles/creating-an-access-token-for-command-line-use/>`_. |
| 144 | |
| 145 | .. attr:: webhook_token |
| 146 | |
| 147 | Required token for validating the webhook event payloads. In |
| 148 | the GitHub App Configuration page, this is called **Webhook |
| 149 | secret**. See `Securing your webhooks |
| 150 | <https://developer.github.com/webhooks/securing/>`_. |
| 151 | |
| 152 | .. attr:: sshkey |
| 153 | :default: ~/.ssh/id_rsa |
| 154 | |
| 155 | Path to SSH key to use when cloning github repositories. |
| 156 | |
| 157 | .. attr:: server |
| 158 | :default: github.com |
| 159 | |
| 160 | Hostname of the github install (such as a GitHub Enterprise). |
| 161 | |
| 162 | .. attr:: canonical_hostname |
| 163 | |
| 164 | The canonical hostname associated with the git repos on the |
| 165 | GitHub server. Defaults to the value of :attr:`<github |
| 166 | connection>.server`. This is used to identify projects from |
| 167 | this connection by name and in preparing repos on the filesystem |
| 168 | for use by jobs. Note that Zuul will still only communicate |
| 169 | with the GitHub server identified by **server**; this option is |
| 170 | useful if users customarily use a different hostname to clone or |
| 171 | pull git repos so that when Zuul places them in the job's |
| 172 | working directory, they appear under this directory name. |
| 173 | |
| 174 | .. attr:: verify_ssl |
| 175 | :default: true |
| 176 | |
| 177 | Enable or disable ssl verification for GitHub Enterprise. This |
| 178 | is useful for a connection to a test installation. |
Tobias Henkel | 65e0e8c | 2017-08-01 13:44:33 +0200 | [diff] [blame] | 179 | |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 180 | Trigger Configuration |
| 181 | --------------------- |
| 182 | GitHub webhook events can be configured as triggers. |
| 183 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 184 | A connection name with the GitHub driver can take multiple events with |
| 185 | the following options. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 186 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 187 | .. attr:: pipeline.trigger.<github source> |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 188 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 189 | The dictionary passed to the GitHub pipeline ``trigger`` attribute |
| 190 | supports the following attributes: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 191 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 192 | .. attr:: event |
| 193 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 194 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 195 | The event from github. Supported events are: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 196 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 197 | .. value:: pull_request |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 198 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 199 | .. value:: pull_request_review |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 200 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 201 | .. value:: push |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 202 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 203 | .. attr:: action |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 204 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 205 | A :value:`pipeline.trigger.<github source>.event.pull_request` |
| 206 | event will have associated action(s) to trigger from. The |
| 207 | supported actions are: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 208 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 209 | .. value:: opened |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 210 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 211 | Pull request opened. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 212 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 213 | .. value:: changed |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 214 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 215 | Pull request synchronized. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 216 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 217 | .. value:: closed |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 218 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 219 | Pull request closed. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 220 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 221 | .. value:: reopened |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 222 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 223 | Pull request reopened. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 224 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 225 | .. value:: comment |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 226 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 227 | Comment added to pull request. |
| 228 | |
| 229 | .. value:: labeled |
| 230 | |
| 231 | Label added to pull request. |
| 232 | |
| 233 | .. value:: unlabeled |
| 234 | |
| 235 | Label removed from pull request. |
| 236 | |
| 237 | .. value:: status |
| 238 | |
| 239 | Status set on commit. |
| 240 | |
| 241 | A :value:`pipeline.trigger.<github |
| 242 | source>.event.pull_request_review` event will have associated |
| 243 | action(s) to trigger from. The supported actions are: |
| 244 | |
| 245 | .. value:: submitted |
| 246 | |
| 247 | Pull request review added. |
| 248 | |
| 249 | .. value:: dismissed |
| 250 | |
| 251 | Pull request review removed. |
| 252 | |
| 253 | .. attr:: branch |
| 254 | |
| 255 | The branch associated with the event. Example: ``master``. This |
| 256 | field is treated as a regular expression, and multiple branches |
| 257 | may be listed. Used for ``pull_request`` and |
| 258 | ``pull_request_review`` events. |
| 259 | |
| 260 | .. attr:: comment |
| 261 | |
| 262 | This is only used for ``pull_request`` ``comment`` actions. It |
| 263 | accepts a list of regexes that are searched for in the comment |
| 264 | string. If any of these regexes matches a portion of the comment |
| 265 | string the trigger is matched. ``comment: retrigger`` will |
| 266 | match when comments containing 'retrigger' somewhere in the |
| 267 | comment text are added to a pull request. |
| 268 | |
| 269 | .. attr:: label |
| 270 | |
| 271 | This is only used for ``labeled`` and ``unlabeled`` |
| 272 | ``pull_request`` actions. It accepts a list of strings each of |
| 273 | which matches the label name in the event literally. ``label: |
| 274 | recheck`` will match a ``labeled`` action when pull request is |
| 275 | labeled with a ``recheck`` label. ``label: 'do not test'`` will |
| 276 | match a ``unlabeled`` action when a label with name ``do not |
| 277 | test`` is removed from the pull request. |
| 278 | |
| 279 | .. attr:: state |
| 280 | |
| 281 | This is only used for ``pull_request_review`` events. It |
| 282 | accepts a list of strings each of which is matched to the review |
| 283 | state, which can be one of ``approved``, ``comment``, or |
| 284 | ``request_changes``. |
| 285 | |
| 286 | .. attr:: status |
| 287 | |
| 288 | This is used for ``pull-request`` and ``status`` actions. It |
| 289 | accepts a list of strings each of which matches the user setting |
| 290 | the status, the status context, and the status itself in the |
| 291 | format of ``user:context:status``. For example, |
| 292 | ``zuul_github_ci_bot:check_pipeline:success``. |
| 293 | |
| 294 | .. attr:: ref |
| 295 | |
| 296 | This is only used for ``push`` events. This field is treated as |
| 297 | a regular expression and multiple refs may be listed. GitHub |
| 298 | always sends full ref name, eg. ``refs/tags/bar`` and this |
| 299 | string is matched against the regular expression. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 300 | |
| 301 | Reporter Configuration |
| 302 | ---------------------- |
| 303 | Zuul reports back to GitHub via GitHub API. Available reports include a PR |
| 304 | comment containing the build results, a commit status on start, success and |
| 305 | failure, an issue label addition/removal on the PR, and a merge of the PR |
| 306 | itself. Status name, description, and context is taken from the pipeline. |
| 307 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 308 | .. attr:: pipeline.<reporter>.<github source> |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 309 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 310 | To report to GitHub, the dictionaries passed to any of the pipeline |
| 311 | :ref:`reporter<reporters>` attributes support the following |
| 312 | attributes: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 313 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 314 | .. attr:: status |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 315 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 316 | String value (``pending``, ``success``, ``failure``) that the |
| 317 | reporter should set as the commit status on github. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 318 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 319 | .. TODO support role markup in :default: so we can xref |
| 320 | :attr:`webapp.status_url` below |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 321 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 322 | .. attr:: status-url |
| 323 | :default: webapp.status_url or the empty string |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 324 | |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 325 | String value for a link url to set in the github |
| 326 | status. Defaults to the zuul server status_url, or the empty |
| 327 | string if that is unset. |
| 328 | |
| 329 | .. attr:: comment |
| 330 | :default: true |
| 331 | |
| 332 | Boolean value that determines if the reporter should add a |
| 333 | comment to the pipeline status to the github pull request. Only |
| 334 | used for Pull Request based items. |
| 335 | |
| 336 | .. attr:: merge |
| 337 | :default: false |
| 338 | |
| 339 | Boolean value that determines if the reporter should merge the |
| 340 | pull reqeust. Only used for Pull Request based items. |
| 341 | |
| 342 | .. attr:: label |
| 343 | |
| 344 | List of strings each representing an exact label name which |
| 345 | should be added to the pull request by reporter. Only used for |
| 346 | Pull Request based items. |
| 347 | |
| 348 | .. attr:: unlabel |
| 349 | |
| 350 | List of strings each representing an exact label name which |
| 351 | should be removed from the pull request by reporter. Only used |
| 352 | for Pull Request based items. |
Monty Taylor | ae1f03a | 2017-07-27 14:43:32 -0500 | [diff] [blame] | 353 | |
| 354 | .. _Github App: https://developer.github.com/apps/ |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 355 | |
| 356 | Requirements Configuration |
| 357 | -------------------------- |
| 358 | |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 359 | As described in :attr:`pipeline.require` and :attr:`pipeline.reject`, |
| 360 | pipelines may specify that items meet certain conditions in order to |
| 361 | be enqueued into the pipeline. These conditions vary according to the |
| 362 | source of the project in question. To supply requirements for changes |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 363 | from a GitHub source named ``my-github``, create a congfiguration such |
James E. Blair | 32c5248 | 2017-07-29 07:49:03 -0700 | [diff] [blame] | 364 | as the following:: |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 365 | |
| 366 | pipeline: |
| 367 | require: |
| 368 | my-github: |
| 369 | review: |
| 370 | - type: approval |
| 371 | |
| 372 | This indicates that changes originating from the GitHub connection |
James E. Blair | 02157ad | 2017-08-03 17:34:22 -0700 | [diff] [blame] | 373 | named ``my-github`` must have an approved code review in order to be |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 374 | enqueued into the pipeline. |
| 375 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 376 | .. attr:: pipeline.require.<github source> |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 377 | |
| 378 | The dictionary passed to the GitHub pipeline `require` attribute |
| 379 | supports the following attributes: |
| 380 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 381 | .. attr:: review |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 382 | |
| 383 | This requires that a certain kind of code review be present for |
| 384 | the pull request (it could be added by the event in question). |
| 385 | It takes several sub-parameters, all of which are optional and |
| 386 | are combined together so that there must be a code review |
| 387 | matching all specified requirements. |
| 388 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 389 | .. attr:: username |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 390 | |
| 391 | If present, a code review from this username is required. It |
| 392 | is treated as a regular expression. |
| 393 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 394 | .. attr:: email |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 395 | |
| 396 | If present, a code review with this email address is |
| 397 | required. It is treated as a regular expression. |
| 398 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 399 | .. attr:: older-than |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 400 | |
| 401 | If present, the code review must be older than this amount of |
| 402 | time to match. Provide a time interval as a number with a |
| 403 | suffix of "w" (weeks), "d" (days), "h" (hours), "m" |
| 404 | (minutes), "s" (seconds). Example ``48h`` or ``2d``. |
| 405 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 406 | .. attr:: newer-than |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 407 | |
| 408 | If present, the code review must be newer than this amount of |
| 409 | time to match. Same format as "older-than". |
| 410 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 411 | .. attr:: type |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 412 | |
| 413 | If present, the code review must match this type (or types). |
| 414 | |
| 415 | .. TODO: what types are valid? |
| 416 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 417 | .. attr:: permission |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 418 | |
| 419 | If present, the author of the code review must have this |
| 420 | permission (or permissions). The available values are |
| 421 | ``read``, ``write``, and ``admin``. |
| 422 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 423 | .. attr:: open |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 424 | |
| 425 | A boolean value (``true`` or ``false``) that indicates whether |
| 426 | the change must be open or closed in order to be enqueued. |
| 427 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 428 | .. attr:: current-patchset |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 429 | |
| 430 | A boolean value (``true`` or ``false``) that indicates whether |
| 431 | the item must be associated with the latest commit in the pull |
| 432 | request in order to be enqueued. |
| 433 | |
| 434 | .. TODO: this could probably be expanded upon -- under what |
| 435 | circumstances might this happen with github |
| 436 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 437 | .. attr:: status |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 438 | |
| 439 | A string value that corresponds with the status of the pull |
| 440 | request. The syntax is ``user:status:value``. |
| 441 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 442 | .. attr:: label |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 443 | |
| 444 | A string value indicating that the pull request must have the |
| 445 | indicated label (or labels). |
| 446 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 447 | .. attr:: pipeline.reject.<github source> |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 448 | |
| 449 | The `reject` attribute is the mirror of the `require` attribute. It |
| 450 | also accepts a dictionary under the connection name. This |
| 451 | dictionary supports the following attributes: |
| 452 | |
James E. Blair | 9437591 | 2017-07-28 17:20:27 -0700 | [diff] [blame] | 453 | .. attr:: review |
James E. Blair | d134c6d | 2017-07-26 16:09:34 -0700 | [diff] [blame] | 454 | |
| 455 | This takes a list of code reviews. If a code review matches the |
| 456 | provided criteria the pull request can not be entered into the |
James E. Blair | 91fe483 | 2017-07-28 17:28:26 -0700 | [diff] [blame] | 457 | pipeline. It follows the same syntax as |
| 458 | :attr:`pipeline.require.<github source>.review` |