From the parent T225730: Reduce runtime of MW shared gate Jenkins jobs to 5 min
- have a pre-flight job that runs the linters for the repository that triggers the patch and hold any other jobs until that one has completed
I'd propose we start with composer test, then think about npm linters afterwards.
Another optimization we could make is to add a flag for quibble to not clone the entire repository when doing lint checks. If we split out the linting step into a standalone service on toolforge or cloud services, quibble ask the service if the patch passes the lint phase, and the service would have a composer cache that can be used to install the relevant codesniffer library version for the patch.
There is some prior art for this in https://gitlab.wikimedia.org/kharlan/fix-suggester-bot/-/blob/main/src/MessageHandler/GerritStreamHandler.php; that code generates fix suggestions but it could be expanded to be more generic if we are interested to have an API for this.
So the model would be something like:
- quibble job for linting starts
- quibble job makes an HTTP request to lint-service
- the lint service should be able to respond within a couple seconds, because it just needs to download the touched files and run composer test -- {files} using the correct version of the codesniffer library, which is already on the server thanks to composer cache
- build fails or passes based on above
steps 2-3 could be done entirely in Quibble, but having as a service seems useful for other tools to build on (like Fix-Suggester-Bot