blob: ced3b78a8573c2a8e46f5218cd653687a19189e2 [file] [log] [blame]
Joshua Hesketh1879cf72013-08-19 14:13:15 +10001:title: Reporters
2
3Reporters
4=========
5
6Zuul can communicate results and progress back to configurable
7protocols. For example, after succeeding in a build a pipeline can be
Michael Prokop526926a2013-10-24 16:16:57 +02008configured to post a positive review back to Gerrit.
Joshua Hesketh1879cf72013-08-19 14:13:15 +10009
10There are three stages when a report can be handled. That is on:
11Start, Success or Failure. Each stage can have multiple reports.
Michael Prokop526926a2013-10-24 16:16:57 +020012For example, you can set verified on Gerrit and send an email.
Joshua Hesketh1879cf72013-08-19 14:13:15 +100013
14Gerrit
15------
16
17Zuul works with standard versions of Gerrit by invoking the
18``gerrit`` command over an SSH connection. It reports back to
19Gerrit using SSH.
20
Michael Prokop526926a2013-10-24 16:16:57 +020021The dictionary passed to the Gerrit reporter is used for ``gerrit
Joshua Hesketh1879cf72013-08-19 14:13:15 +100022review`` arguments, with the boolean value of ``true`` simply
23indicating that the argument should be present without following it
24with a value. For example, ``verified: 1`` becomes ``gerrit review
25--verified 1`` and ``submit: true`` becomes ``gerrit review
26--submit``.
27
Joshua Heskethfe485c62015-08-11 23:42:34 +100028A :ref:`connection` that uses the gerrit driver must be supplied to the
29trigger.
Joshua Hesketh5fea8672013-08-19 17:32:01 +100030
Wayne40f40042015-06-12 16:56:30 -070031GitHub
32------
33
34Zuul reports back to GitHub pull requests via GitHub API.
Jan Hrubane252a732017-01-03 15:03:09 +010035On success and failure, it creates a comment containing the build results.
36It also sets the status on start, success and failure. Status name and
37description is taken from the pipeline.
38
39A :ref:`connection` that uses the github driver must be supplied to the
40reporter. 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
47 **comment**
48 Boolean value (``true`` or ``false``) that determines if the reporter should
49 add a comment to the pipeline status to the github pull request. Defaults
50 to ``true``.
51 ``comment: false``
Wayne40f40042015-06-12 16:56:30 -070052
Jan Hruban49bff072015-11-03 11:45:46 +010053 **merge**
54 Boolean value (``true`` or ``false``) that determines if the reporter should
55 merge the pull reqeust. Defaults to ``false``.
56 ``merge=true``
57
Joshua Hesketh5fea8672013-08-19 17:32:01 +100058SMTP
59----
60
61A simple email reporter is also available.
62
Joshua Heskethfe485c62015-08-11 23:42:34 +100063A :ref:`connection` that uses the smtp driver must be supplied to the
Joshua Heskethd78b4482015-09-14 16:56:34 -060064reporter.
Joshua Heskethfe485c62015-08-11 23:42:34 +100065
Joshua Hesketh5fea8672013-08-19 17:32:01 +100066SMTP Configuration
67~~~~~~~~~~~~~~~~~~
68
Łukasz Jernaś048acb42014-03-02 18:49:41 +010069zuul.conf contains the SMTP server and default to/from as described
Joshua Hesketh5fea8672013-08-19 17:32:01 +100070in :ref:`zuulconf`.
71
Łukasz Jernaś048acb42014-03-02 18:49:41 +010072Each pipeline can overwrite the ``subject`` or the ``to`` or ``from`` address by
James E. Blaire5910202013-12-27 09:50:31 -080073providing alternatives as arguments to the reporter. For example, ::
Joshua Hesketh5fea8672013-08-19 17:32:01 +100074
75 pipelines:
76 - name: post-merge
77 manager: IndependentPipelineManager
Joshua Heskethfe485c62015-08-11 23:42:34 +100078 source: my_gerrit
Joshua Hesketh5fea8672013-08-19 17:32:01 +100079 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +100080 my_gerrit:
81 - event: change-merged
Joshua Hesketh5fea8672013-08-19 17:32:01 +100082 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +100083 outgoing_smtp:
Joshua Hesketh5fea8672013-08-19 17:32:01 +100084 to: you@example.com
85 failure:
Joshua Heskethfe485c62015-08-11 23:42:34 +100086 internal_smtp:
Joshua Hesketh5fea8672013-08-19 17:32:01 +100087 to: you@example.com
88 from: alternative@example.com
James E. Blaire5910202013-12-27 09:50:31 -080089 subject: Change {change} failed
Joshua Heskethd78b4482015-09-14 16:56:34 -060090
91SQL
92---
93
94This reporter is used to store results in a database.
95
96A :ref:`connection` that uses the sql driver must be supplied to the
97reporter.
98
99SQL Configuration
100~~~~~~~~~~~~~~~~~
101
102zuul.conf contains the database connection and credentials. To store different
103reports in different databases you'll need to create a new connection per
104database.
105
106The sql reporter is used to store the results from individual builds rather
107than the change. As such the sql reporter does nothing on "start" or
108"merge-failure".
109
110**score**
111 A score to store for the result of the build. eg: -1 might indicate a failed
112 build similar to the vote posted back via the gerrit reporter.
113
114For example ::
115
116 pipelines:
117 - name: post-merge
118 manager: IndependentPipelineManager
119 source: my_gerrit
120 trigger:
121 my_gerrit:
122 - event: change-merged
123 success:
124 mydb_conn:
125 score: 1
126 failure:
127 mydb_conn:
128 score: -1