blob: 4972e66df972167df14b1fb875ad9ae1665fe2e3 [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.
35It will create a comment containing the job status.
36
Joshua Hesketh5fea8672013-08-19 17:32:01 +100037SMTP
38----
39
40A simple email reporter is also available.
41
Joshua Heskethfe485c62015-08-11 23:42:34 +100042A :ref:`connection` that uses the smtp driver must be supplied to the
Joshua Heskethd78b4482015-09-14 16:56:34 -060043reporter.
Joshua Heskethfe485c62015-08-11 23:42:34 +100044
Joshua Hesketh5fea8672013-08-19 17:32:01 +100045SMTP Configuration
46~~~~~~~~~~~~~~~~~~
47
Łukasz Jernaś048acb42014-03-02 18:49:41 +010048zuul.conf contains the SMTP server and default to/from as described
Joshua Hesketh5fea8672013-08-19 17:32:01 +100049in :ref:`zuulconf`.
50
Łukasz Jernaś048acb42014-03-02 18:49:41 +010051Each pipeline can overwrite the ``subject`` or the ``to`` or ``from`` address by
James E. Blaire5910202013-12-27 09:50:31 -080052providing alternatives as arguments to the reporter. For example, ::
Joshua Hesketh5fea8672013-08-19 17:32:01 +100053
54 pipelines:
55 - name: post-merge
56 manager: IndependentPipelineManager
Joshua Heskethfe485c62015-08-11 23:42:34 +100057 source: my_gerrit
Joshua Hesketh5fea8672013-08-19 17:32:01 +100058 trigger:
Joshua Heskethfe485c62015-08-11 23:42:34 +100059 my_gerrit:
60 - event: change-merged
Joshua Hesketh5fea8672013-08-19 17:32:01 +100061 success:
Joshua Heskethfe485c62015-08-11 23:42:34 +100062 outgoing_smtp:
Joshua Hesketh5fea8672013-08-19 17:32:01 +100063 to: you@example.com
64 failure:
Joshua Heskethfe485c62015-08-11 23:42:34 +100065 internal_smtp:
Joshua Hesketh5fea8672013-08-19 17:32:01 +100066 to: you@example.com
67 from: alternative@example.com
James E. Blaire5910202013-12-27 09:50:31 -080068 subject: Change {change} failed
Joshua Heskethd78b4482015-09-14 16:56:34 -060069
70SQL
71---
72
73This reporter is used to store results in a database.
74
75A :ref:`connection` that uses the sql driver must be supplied to the
76reporter.
77
78SQL Configuration
79~~~~~~~~~~~~~~~~~
80
81zuul.conf contains the database connection and credentials. To store different
82reports in different databases you'll need to create a new connection per
83database.
84
85The sql reporter is used to store the results from individual builds rather
86than the change. As such the sql reporter does nothing on "start" or
87"merge-failure".
88
89**score**
90 A score to store for the result of the build. eg: -1 might indicate a failed
91 build similar to the vote posted back via the gerrit reporter.
92
93For example ::
94
95 pipelines:
96 - name: post-merge
97 manager: IndependentPipelineManager
98 source: my_gerrit
99 trigger:
100 my_gerrit:
101 - event: change-merged
102 success:
103 mydb_conn:
104 score: 1
105 failure:
106 mydb_conn:
107 score: -1