Mailing List Archive

Experiment nicer CI reporting in Gerrit
Hello,

On our Gerrit, CI results are displayed below the commit message as a
HTML table. It is achieved by a few lines of JavaScript which parse the
comments. I went to write a replacement based on a system builtin
Gerrit: Checks API
<https://gerrit.wikimedia.org/r/Documentation/pg-plugin-checks-api.html>
. An early example: https://phabricator.wikimedia.org/F35814298 .

I could use some early adopters to try out the plugin and gather some
early feedback. If all goes well I will roll it on our Gerrit instance.

If you are curious or want to provide some feedback, below are the
instructions to run it on your local machine.

In Chrome/Chromium, install the Gerrit Frontend Dev Helper extension
<https://chrome.google.com/webstore/detail/gerrit-fe-dev-helper/jimgomcnodkialnpmienbomamgomglkd>.
It is used to inject the JavaScript plugin from a locally running web
server.

Create a new empty directory

Retrieve the JavaScript Gerrit plugin from Change 859083
<https://gerrit.wikimedia.org/r/c/operations/software/gerrit/+/859083/>:

curl -o wm-checks-api.js
'https://gerrit.wikimedia.org/r/changes/operations%2Fsoftware%2Fgerrit~859083/revisions/16/files/plugins%2Fwm-checks-api.js/download'

Retrieve a PHP router for the PHP built-in webserver. It would inject
cross origin headers when serving a response:

curl -o plugins-router.php
'https://gerrit.wikimedia.org/r/changes/operations%2Fsoftware%2Fgerrit~860885/revisions/1/files/plugins-router.php/download'

Start a PHP Webserver to serve the plugin:

php -S 127.0.0.1:8081 plugins-router.php

Head to https://gerrit.wikimedia.org/ and enable the Gerrit FE dev
helper plugin. The page will reload.

Click again the browser extension and a configuration popup will appear.
Using the ADD button add an entry with:

* Operator: injectJSPlugin
* Destination: http://127.0.0.1:8081/wm-checks-api.js

Click SAVE. The page reloads and the plugin should have been injected
(there would be a little red box in the bottom right of the Gerrit
page). When browsing a change that previously had CI comments, you
should see a Checks tab which hold the results found by the plugin.

The series of changes is in Gerrit
https://gerrit.wikimedia.org/r/q/topic:checks-api

--
Antoine Musso
/(a good chunk of the code was written late at night over a week-end, I
had to rerelearn JavaScript and discovered TypeScript in the process)./
Re: Experiment nicer CI reporting in Gerrit [ In reply to ]
Nice! Where can we give feedback / report bugs?

Kosta

> On 5. Dec 2022, at 14:27, Antoine Musso <hashar@free.fr> wrote:
>
> Hello,
>
> On our Gerrit, CI results are displayed below the commit message as a HTML table. It is achieved by a few lines of JavaScript which parse the comments. I went to write a replacement based on a system builtin Gerrit: Checks API <https://gerrit.wikimedia.org/r/Documentation/pg-plugin-checks-api.html> . An early example: https://phabricator.wikimedia.org/F35814298 .
>
> I could use some early adopters to try out the plugin and gather some early feedback. If all goes well I will roll it on our Gerrit instance.
>
> If you are curious or want to provide some feedback, below are the instructions to run it on your local machine.
>
> In Chrome/Chromium, install the Gerrit Frontend Dev Helper extension <https://chrome.google.com/webstore/detail/gerrit-fe-dev-helper/jimgomcnodkialnpmienbomamgomglkd>. It is used to inject the JavaScript plugin from a locally running web server.
> Create a new empty directory
>
> Retrieve the JavaScript Gerrit plugin from Change 859083 <https://gerrit.wikimedia.org/r/c/operations/software/gerrit/+/859083/>:
> curl -o wm-checks-api.js 'https://gerrit.wikimedia.org/r/changes/operations%2Fsoftware%2Fgerrit~859083/revisions/16/files/plugins%2Fwm-checks-api.js/download'
>
> Retrieve a PHP router for the PHP built-in webserver. It would inject cross origin headers when serving a response:
> curl -o plugins-router.php 'https://gerrit.wikimedia.org/r/changes/operations%2Fsoftware%2Fgerrit~860885/revisions/1/files/plugins-router.php/download'
>
> Start a PHP Webserver to serve the plugin:
>
> php -S 127.0.0.1:8081 plugins-router.php
>
> Head to https://gerrit.wikimedia.org/ and enable the Gerrit FE dev helper plugin. The page will reload.
>
> Click again the browser extension and a configuration popup will appear. Using the ADD button add an entry with:
>
> Operator: injectJSPlugin
> Destination: http://127.0.0.1:8081/wm-checks-api.js
> Click SAVE. The page reloads and the plugin should have been injected (there would be a little red box in the bottom right of the Gerrit page). When browsing a change that previously had CI comments, you should see a Checks tab which hold the results found by the plugin.
>
> The series of changes is in Gerrit https://gerrit.wikimedia.org/r/q/topic:checks-api
>
> --
> Antoine Musso
> (a good chunk of the code was written late at night over a week-end, I had to rerelearn JavaScript and discovered TypeScript in the process).
>
>
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Experiment nicer CI reporting in Gerrit [ In reply to ]
Le 05/12/2022 à 14:27, Antoine Musso a écrit :
>
> Hello,
>
> On our Gerrit, CI results are displayed below the commit message as a
> HTML table. It is achieved by a few lines of JavaScript which parse
> the comments. I went to write a replacement based on a system builtin
> Gerrit: Checks API
> <https://gerrit.wikimedia.org/r/Documentation/pg-plugin-checks-api.html> .
> <snip>
>
Hello,

I have deployed the new UI plugin on our Gerrit. It replaces the HTML
table shown below the commit message by a few bubbles representing the
state of tests for the latest patchset.

Details of the CI jobs are available in the "Checks" table next to
"Files" and "Comments". There is a drop down that lets one browse CI
runs for previous patchsets.

The job results are still available as comments and are the one
triggering notifications or Verified +1/-1.  The new UI comes on top of
that to offer a slightly better representation.

If you find issues or have questions, please either:

- reply to this thread

- reach out to me on IRC (hashar on libera.chat in #wikimedia-releng)

- file a task in Phabricator against #gerrit  ;)

Antoine "hashar" Musso
Re: Experiment nicer CI reporting in Gerrit [ In reply to ]
It took me a few times to get adjusted, but I like it!

Thanks for pushing this!

On 12/13 13:05, Antoine Musso wrote:
> Le 05/12/2022 ? 14:27, Antoine Musso a ?crit?:
> >
> > Hello,
> >
> > On our Gerrit, CI results are displayed below the commit message as a
> > HTML table. It is achieved by a few lines of JavaScript which parse the
> > comments. I went to write a replacement based on a system builtin
> > Gerrit: Checks API
> > <https://gerrit.wikimedia.org/r/Documentation/pg-plugin-checks-api.html>
> > .
> > <snip>
> >
> Hello,
>
> I have deployed the new UI plugin on our Gerrit. It replaces the HTML table
> shown below the commit message by a few bubbles representing the state of
> tests for the latest patchset.
>
> Details of the CI jobs are available in the "Checks" table next to "Files"
> and "Comments". There is a drop down that lets one browse CI runs for
> previous patchsets.
>
> The job results are still available as comments and are the one triggering
> notifications or Verified +1/-1.? The new UI comes on top of that to offer a
> slightly better representation.
>
> If you find issues or have questions, please either:
>
> - reply to this thread
>
> - reach out to me on IRC (hashar on libera.chat in #wikimedia-releng)
>
> - file a task in Phabricator against #gerrit? ;)
>
> Antoine "hashar" Musso
>

> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


--
David Caro
SRE - Cloud Services
Wikimedia Foundation <https://wikimediafoundation.org/>
PGP Signature: 7180 83A2 AC8B 314F B4CE 1171 4071 C7E1 D262 69C3

"Imagine a world in which every single human being can freely share in the
sum of all knowledge. That's our commitment."