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 | |
| 31 | SMTP |
| 32 | ---- |
| 33 | |
| 34 | A simple email reporter is also available. |
| 35 | |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 36 | 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] | 37 | reporter. |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 38 | |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 39 | SMTP Configuration |
| 40 | ~~~~~~~~~~~~~~~~~~ |
| 41 | |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 42 | zuul.conf contains the SMTP server and default to/from as described |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 43 | in :ref:`zuulconf`. |
| 44 | |
Łukasz Jernaś | 048acb4 | 2014-03-02 18:49:41 +0100 | [diff] [blame] | 45 | 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] | 46 | providing alternatives as arguments to the reporter. For example, :: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 47 | |
| 48 | pipelines: |
| 49 | - name: post-merge |
| 50 | manager: IndependentPipelineManager |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 51 | source: my_gerrit |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 52 | trigger: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 53 | my_gerrit: |
| 54 | - event: change-merged |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 55 | success: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 56 | outgoing_smtp: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 57 | to: you@example.com |
| 58 | failure: |
Joshua Hesketh | fe485c6 | 2015-08-11 23:42:34 +1000 | [diff] [blame] | 59 | internal_smtp: |
Joshua Hesketh | 5fea867 | 2013-08-19 17:32:01 +1000 | [diff] [blame] | 60 | to: you@example.com |
| 61 | from: alternative@example.com |
James E. Blair | e591020 | 2013-12-27 09:50:31 -0800 | [diff] [blame] | 62 | subject: Change {change} failed |
Joshua Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 63 | |
| 64 | SQL |
| 65 | --- |
| 66 | |
| 67 | This reporter is used to store results in a database. |
| 68 | |
| 69 | A :ref:`connection` that uses the sql driver must be supplied to the |
| 70 | reporter. |
| 71 | |
| 72 | SQL Configuration |
| 73 | ~~~~~~~~~~~~~~~~~ |
| 74 | |
| 75 | zuul.conf contains the database connection and credentials. To store different |
| 76 | reports in different databases you'll need to create a new connection per |
| 77 | database. |
| 78 | |
| 79 | The sql reporter is used to store the results from individual builds rather |
| 80 | than the change. As such the sql reporter does nothing on "start" or |
| 81 | "merge-failure". |
| 82 | |
| 83 | **score** |
| 84 | A score to store for the result of the build. eg: -1 might indicate a failed |
| 85 | build similar to the vote posted back via the gerrit reporter. |
| 86 | |
| 87 | For example :: |
| 88 | |
| 89 | pipelines: |
| 90 | - name: post-merge |
| 91 | manager: IndependentPipelineManager |
| 92 | source: my_gerrit |
| 93 | trigger: |
| 94 | my_gerrit: |
| 95 | - event: change-merged |
| 96 | success: |
| 97 | mydb_conn: |
| 98 | score: 1 |
| 99 | failure: |
| 100 | mydb_conn: |
| 101 | score: -1 |