Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 1 | :title: Reporters |
| 2 | |
| 3 | Reporters |
| 4 | ========= |
| 5 | |
| 6 | Zuul can communicate results and progress back to configurable |
| 7 | protocols. For example, after succeeding in a build a pipeline can be |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 8 | configured to post a positive review back to Gerrit. |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 9 | |
| 10 | There are three stages when a report can be handled. That is on: |
| 11 | Start, Success or Failure. Each stage can have multiple reports. |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 12 | For example, you can set verified on Gerrit and send an email. |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 13 | |
| 14 | Gerrit |
| 15 | ------ |
| 16 | |
| 17 | Zuul works with standard versions of Gerrit by invoking the |
| 18 | ``gerrit`` command over an SSH connection. It reports back to |
| 19 | Gerrit using SSH. |
| 20 | |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 21 | The dictionary passed to the Gerrit reporter is used for ``gerrit |
Joshua Hesketh | 1879cf7 | 2013-08-19 14:13:15 +1000 | [diff] [blame] | 22 | review`` arguments, with the boolean value of ``true`` simply |
| 23 | indicating that the argument should be present without following it |
| 24 | with a value. For example, ``verified: 1`` becomes ``gerrit review |
| 25 | --verified 1`` and ``submit: true`` becomes ``gerrit review |
| 26 | --submit``. |
| 27 | |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 28 | A :ref:`connection` that uses the gerrit driver must be supplied to the |
| 29 | trigger. |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 30 | |
Wayne | 40f4004 | 2015-06-12 16:56:30 -0700 | [diff] [blame] | 31 | GitHub |
| 32 | ------ |
| 33 | |
Jesse Keating | 8968007 | 2017-06-14 10:37:11 -0700 | [diff] [blame] | 34 | Zuul reports back to GitHub via GitHub API. Available reports include a PR |
| 35 | comment containing the build results, a commit status on start, success and |
| 36 | failure, an issue label addition/removal on the PR, and a merge of the PR |
| 37 | itself. Status name, description, and context is taken from the pipeline. |
Jan Hruban | e252a73 | 2017-01-03 15:03:09 +0100 | [diff] [blame] | 38 | |
| 39 | A :ref:`connection` that uses the github driver must be supplied to the |
| 40 | reporter. It has the following options: |
| 41 | |
| 42 | **status** |
| 43 | String value (``pending``, ``success``, ``failure``) that the reporter should |
| 44 | set as the commit status on github. |
| 45 | ``status: 'success'`` |
| 46 | |
K Jonathan Harker | 0c40cdc | 2017-06-02 11:31:34 -0700 | [diff] [blame] | 47 | **status-url** |
| 48 | String value for a link url to set in the github status. Defaults to the zuul |
| 49 | server status_url, or the empty string if that is unset. |
| 50 | |
Jan Hruban | e252a73 | 2017-01-03 15:03:09 +0100 | [diff] [blame] | 51 | **comment** |
| 52 | Boolean value (``true`` or ``false``) that determines if the reporter should |
| 53 | add a comment to the pipeline status to the github pull request. Defaults |
Jesse Keating | 8968007 | 2017-06-14 10:37:11 -0700 | [diff] [blame] | 54 | to ``true``. Only used for Pull Request based events. |
Jan Hruban | e252a73 | 2017-01-03 15:03:09 +0100 | [diff] [blame] | 55 | ``comment: false`` |
Wayne | 40f4004 | 2015-06-12 16:56:30 -0700 | [diff] [blame] | 56 | |
Jan Hruban | 49bff07 | 2015-11-03 11:45:46 +0100 | [diff] [blame] | 57 | **merge** |
| 58 | Boolean value (``true`` or ``false``) that determines if the reporter should |
Jesse Keating | 8968007 | 2017-06-14 10:37:11 -0700 | [diff] [blame] | 59 | merge the pull reqeust. Defaults to ``false``. Only used for Pull Request based |
| 60 | events. |
Jan Hruban | 49bff07 | 2015-11-03 11:45:46 +0100 | [diff] [blame] | 61 | ``merge=true`` |
| 62 | |
Jan Hruban | 16ad31f | 2015-11-07 14:39:07 +0100 | [diff] [blame] | 63 | **label** |
| 64 | List of strings each representing an exact label name which should be added |
Jesse Keating | 8968007 | 2017-06-14 10:37:11 -0700 | [diff] [blame] | 65 | to the pull request by reporter. Only used for Pull Request based events. |
Jan Hruban | 16ad31f | 2015-11-07 14:39:07 +0100 | [diff] [blame] | 66 | ``label: 'test successful'`` |
| 67 | |
| 68 | **unlabel** |
| 69 | List of strings each representing an exact label name which should be removed |
Jesse Keating | 8968007 | 2017-06-14 10:37:11 -0700 | [diff] [blame] | 70 | from the pull request by reporter. Only used for Pull Request based events. |
Jan Hruban | 16ad31f | 2015-11-07 14:39:07 +0100 | [diff] [blame] | 71 | ``unlabel: 'test failed'`` |
| 72 | |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 73 | SMTP |
| 74 | ---- |
| 75 | |
| 76 | A simple email reporter is also available. |
| 77 | |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 78 | A :ref:`connection` that uses the smtp driver must be supplied to the |
Joshua Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 79 | reporter. |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 80 | |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 81 | SMTP Configuration |
| 82 | ~~~~~~~~~~~~~~~~~~ |
| 83 | |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 84 | zuul.conf contains the SMTP server and default to/from as described |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 85 | in :ref:`zuulconf`. |
| 86 | |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 87 | Each pipeline can overwrite the ``subject`` or the ``to`` or ``from`` address by |
James E. Blair | e591020 | 2013-12-27 09:50:31 -0800 | [diff] [blame] | 88 | providing alternatives as arguments to the reporter. For example, :: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 89 | |
| 90 | pipelines: |
| 91 | - name: post-merge |
| 92 | manager: IndependentPipelineManager |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 93 | source: my_gerrit |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 94 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 95 | my_gerrit: |
| 96 | - event: change-merged |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 97 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 98 | outgoing_smtp: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 99 | to: you@example.com |
| 100 | failure: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 101 | internal_smtp: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 102 | to: you@example.com |
| 103 | from: alternative@example.com |
James E. Blair | e591020 | 2013-12-27 09:50:31 -0800 | [diff] [blame] | 104 | subject: Change {change} failed |
Joshua Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 105 | |
| 106 | SQL |
| 107 | --- |
| 108 | |
| 109 | This reporter is used to store results in a database. |
| 110 | |
| 111 | A :ref:`connection` that uses the sql driver must be supplied to the |
| 112 | reporter. |
| 113 | |
| 114 | SQL Configuration |
| 115 | ~~~~~~~~~~~~~~~~~ |
| 116 | |
| 117 | zuul.conf contains the database connection and credentials. To store different |
| 118 | reports in different databases you'll need to create a new connection per |
| 119 | database. |
| 120 | |
| 121 | The sql reporter is used to store the results from individual builds rather |
| 122 | than the change. As such the sql reporter does nothing on "start" or |
| 123 | "merge-failure". |
| 124 | |
| 125 | **score** |
| 126 | A score to store for the result of the build. eg: -1 might indicate a failed |
| 127 | build similar to the vote posted back via the gerrit reporter. |
| 128 | |
| 129 | For example :: |
| 130 | |
| 131 | pipelines: |
| 132 | - name: post-merge |
| 133 | manager: IndependentPipelineManager |
| 134 | source: my_gerrit |
| 135 | trigger: |
| 136 | my_gerrit: |
| 137 | - event: change-merged |
| 138 | success: |
| 139 | mydb_conn: |
| 140 | score: 1 |
| 141 | failure: |
| 142 | mydb_conn: |
| 143 | score: -1 |