templates/cypress: Run tests in parallel using sorry-cypress
In order to gain some time when executing Jenkins jobs for swh-web, execute cypress tests in parallel using 4 runners thanks to the sorry-cypress tool.
To do so, we use the docker features of Jenkins pipeline. One sidecar container is created to execute the sorry-cypress server and parallel tests are executed in another container spawning 4 cypress processes. The communication between the two containers is done through a dedicated docker network.
Regarding code coverage, we now need to merge the outputs produced by the 4 runners before generating reports.
This change brings a 2x speedup on overall swh-web build jobs execution (when a single job is executed, speedup is lesser when multiple jobs are executed in parallel but still significative).
Also restrict the maximum number of concurrent builds per job to 3 in order to avoid executing too many cypress processes at the same time as they consume quite a lot of resources on the Jenkins node.
Related to T3423
Depends on !140 (closed)
Test Plan
I have created a new pipeline for swh-web on our Jenkins instance with these changes. This seems to work great, even when multiple jobs are executed in parallel.
I will continue to battle test this next week.
Migrated from D8328 (view on Phabricator)