[QA] How to make jenkins-bot write custom messages?

Antoine Musso hashar+wmf at free.fr
Tue Feb 6 22:19:19 UTC 2018

On 23/01/2018 19:55, Tyler Cipriani wrote:
>> Is it possible to have jenkins write custom messages besides the normal
>> success/failure?
> Looked at the source of zuul-reporter a bit today[0]. From the looks of
> it the only knobs to turn are the {failure,success,footer}-message
> parameters for a pipeline as defined in zuul/layout.yaml. The
> pipeline.footer-message[1] is appended to all jobs, but that doesn't
> look particularly dynamic[2][3].
> -- Tyler
> [0].
> <https://github.com/wikimedia/integration-zuul/blob/patch-queue/debian/jessie-wikimedia/zuul/reporter/__init__.py>
> [1].
> <https://docs.openstack.org/infra/zuul/user/config.html#attr-pipeline.footer-message>
> [2].
> <https://github.com/wikimedia/integration-zuul/blob/patch-queue/debian/jessie-wikimedia/zuul/reporter/__init__.py#L79>
> [3].
> <https://github.com/wikimedia/integration-zuul/blob/patch-queue/debian/jessie-wikimedia/zuul/scheduler.py#L439>


The reporter are quite nice, and IIRC you can pass then any objects you
want. The trick though is that the status report is emitted by the
Gearman client on Jenkins, and its result payload is rather scarse. I
don't think there is anyway to add additional results in there.

Supposedly, Zuul v3 has some system for more elaborate reporting but I
haven't dig into it.

What could eventually be possible is to write a custom reporter that
would grab a file from the build artifacts on Jenkins and then write an
additional message to the Gerrit change.

The flow would thus be:

 Job fails
 Gearman reports the status to Zuul
 Zuul report on the change as usual (success/failure message)
 Zuul trigger our custom reporter which:
  - given the build curl the build artifacts for a file like report.txt
  - aggregate the different files / prettify
  - write a new comment to the Gerrit change

I am not sure how doable it is though :(

Antoine Musso

More information about the QA mailing list