Problem/Motivation
Core has three overall stages in gitlab pipelines: Build, Lint and Test.
The build stage consists of two jobs - composer and yarn, which exist only to build caches/artifiacts for later stages.
However, composer install and yarn install very fast, maybe 10 seconds or so on gitlab, while waiting for a runner, downloading an image and running a job in total is at least 45s-1m.
If we flatten the build and yarn jobs, and have the lint jobs do their own yarn and composer installs, then we only add 5-10 seconds to each lint job, but we save a full minute by running the build and lint jobs in parallel.
Because the lint jobs will now be doing composer install and yarn install, we can then go a step further and use those to build the caches for the test pipeline/stage, removing the composer and yarn jobs altogether.
This means we lose two jobs from the pipeline (couple of minutes of compute time), while doing an extra 2-3 composer/yarn installs (probably 30-60s of compute time). It should save on both wall time and compute time overall.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3463479-nr-bot.txt | 90 bytes | needs-review-queue-bot |
Issue fork drupal-3463479
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3463479-10.4.x
changes, plain diff MR !8960
- 3463479-merge-the-build
changes, plain diff MR !8903
Comments
Comment #3
catchComment #4
mstrelan commentedComment #5
catchComment #6
larowlanYeah this came from how we test on circle ci where spin up is faster, agree on current gitlab setup it's hurting us in overall resection time
Comment #7
catchOnly realised this after working on #3462763: Use artifacts to share the phpstan result and cspell caches from core to MRs and seeing just how much time we were spending on spinning up vs doing things. With the combination of the two issues, the newly combined lint stage finishes in around a minute. Once we add cspell/phpcs/eslint cache support, it should be consistently under a minute hopefully.
Comment #8
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #9
catchJust a straightforward rebase.
However I noticed since we added when: manual to the performance job, the job is blocked - needs to allow fail too it looks like.
Comment #10
catchComment #11
catchLatest pipeline on the MR finished in 6 minutes and 52 seconds: https://git.drupalcode.org/project/drupal/-/pipelines/233855
Comment #12
catchThis will also help the performance test run finish quicker. At the moment we're building composer and yarn to use the cache in performance tests, but it's much quicker to just run composer install in the actual test job before running the tests. Should save ~90s on those jobs.
Comment #13
catchSince this takes a full minute off every core MR pipeline, bumping to major.
Combining this with some other changes, was able to get the minimum time for a full MR pipeline run down to 5m37s https://git.drupalcode.org/project/drupal/-/pipelines/234735
Comment #14
spokjeThe nightwatch job failed, not sure if fluke or bad, and can't rerun since MR was created by a core committer.
Comment #15
catchShouldn't affect the nightwatch test at all but re-ran it just in case.
Comment #16
spokjeThanks, tests are now green, as expected.
Code changes make sense.
RTBC for me.
Comment #20
nod_Committed 3c4f80a and pushed to 11.0.x. Thanks!
Committed 3c4f80a and pushed to 11.0.x. Thanks!
Doesn't cherry pick to 10.4.x, need a new MR for it if we want to backport that
Comment #21
catchOK the commit conflicts are because we haven't done #3428614: Resync .gitlab-ci.yml and .gitignore following Yarn 4 in 11.x yet. Put up an MR there. Once that's in, this should be a clean(er) cherry-pick.
Comment #22
catchDouble checked the performance pipeline on 11.x and it's down to 8m30 now with the combination of this and #3463351: Consolidate Umami performance tests, was previously closer to 13 minutes.
https://git.drupalcode.org/project/drupal/-/pipelines/235402
Comment #23
nod_Still an issue with the cherry pick, but not too bad
Comment #24
spokjeI think 10.4.x-dev is the correct version for this now.
Comment #25
spokjeAnd as was said in #21, lets postpone this on #3428614: Resync .gitlab-ci.yml and .gitignore following Yarn 4 in 11.x to make our lives easier.
Comment #27
nod_Comment #28
catchBackport looks good.
Opened an issue for gitlab_templates since we might see a similar improvement there #3464400: Consider merging the build and validate stages.
Comment #29
nod_adding back the
-sfor yarn 1 that got squeezed from https://git.drupalcode.org/project/drupal/-/commit/19c608d552a3bbedc554a...Comment #32
nod_Committed and pushed 963de90958 to 10.4.x and d170a1e09d to 10.3.x. Thanks!
Comment #35
wim leersThanks for #3464400: Consider merging the build and validate stages! 🙏