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-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to