Abstract
The Jenkins jobs triggered for oojs/ui.git takes too much resources on the CI infrastructure, specially when lot of changes are made in a serie and merged.
Spin off of T155444. Taking https://gerrit.wikimedia.org/r/#/c/332344/ as an example given one propose a patch, +2 it and then jobs run after merge we got:
test | time |
---|---|
composer-package-hhvm-trusty | 44s |
composer-package-php55-trusty | 48s |
oojs-ui-npm-node-4-jessie | 12m 05s |
oojs-ui-npm-run-demos-node-4-jessie | 9m 30s |
oojs-ui-npm-run-doc-node-4-jessie | 8m 35s |
gate | time |
composer-package-hhvm-trusty | 41s |
composer-package-php55-trusty | 37s |
oojs-ui-npm-node-4-jessie | 10m 16s |
oojs-ui-npm-run-demos-node-4-jessie | 9m 02s |
oojs-ui-npm-run-doc-node-4-jessie | 5m 55s |
post merge | time |
oojs-ui-jsduck-publish | 9m 31s |
oojs-ui-doxygen-publish | 9s |
oojs-ui-coverage | 12m 06s |
oojs-ui-demos-publish | 11m 24s |
So if one send a patch and +2 it that is six Jessie instances being busy for 6 minutes or four during 9-10 minutes. It only takes three such patches to consume the whole pool.
A serie of 30 patches got merged on March 14th 2016 between 19:00UTC to midnight and from 17:50UTC to midnight that is 241 jobs and thus 241 instances consumed. That is too much for the CI infrastructure to handle.
Jobs detail
When patches are proposed for the oojs/ui.git repository, we trigger three different jobs that run:
- npm test : grunt test
- npm demos : grunt publish-build demos
- npm doc : grunt build && jsduck && copy:jsduck
All of them share the CI setup overhead to clone the repository. They then run npm install which probably takes half of the build time.
Each also invoke composer install, though it benefits from caching.
Looking at the grunt tasks being run, each job also share common tasks some being rather slow (ex: colorizeSvg, svg2png:dist).
Tasks breakdown
Using the job console output:
vimdiff <(grep 'Running' npm-test.log) <(grep 'Running' npm-run-demos.log) <(grep 'Running' npm-run-doc.log)
:TOhtml
https://people.wikimedia.org/~hashar/T160513/tasksdiff.html
What would be nice
- I would like all three build steps (test, doc, demos) to be unified in a single Jenkins job. That would clear out the overhead of git clone / npm install.
- We probably want a new task defining the tasks to run, paying attention to avoid running twice the slowest one (svg2png and colorizeSvg).
We can have Jenkins to invoke a specific npm entry point such as npm run jenkins which would have the appropriate pre/post task and maybe invoke a specific/custom grunt task.