Improve the duration of GitLab E2E pipelines that run package-and-qa to increase efficiency for SETs
Related to gitlab-com/www-gitlab-com#9501 (closed).
Identified problems
fetch-assets could avoid installing gems altogether since it only needs to retrieve the gitlab-rails version.
By stopping installing gems, the script step of the job goes from 2m 08s (https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/960264440) to 22s (https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/960294422). We can save 1m 46s here.
fetch-assets is installing all the gems from scratch (no cache)
Example: https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/958638133
=> omnibus-gitlab!4920 (merged)
Trigger:package is caching .yarn-cache which is very heavy
In gitlab-org/gitlab, we discovered that caching .yarn-cache wasn't very useful (it's more useful to cache node_modules).
In gitlab-org/omnibus-gitlab, we can see that downloading/extracting and compressing/uploading the cache can be quite long (respectively 6 minutes and 3 minutes, see https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/946661169). Also, installing the gems with an existing .yarn-cache takes about 7 seconds (https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/946661169), and 35 seconds without cache (https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/jobs/958638135). Uploading the cache without .yarn-cache takes 1 minute and retrieving the cache takes 1.5 minute.
Following is a table comparing the different cache strategy:
| Step | Duration with .yarn-cache cached |
Duration without .yarn-cache cached |
Duration with node_modules cached |
|---|---|---|---|
Restoring cache |
6m 08s | 1m 29s | 2m 12s |
yarn install --pure-lockfile --production --cache-folder .yarn-cache' |
7s | 35s | 1.1s |
Saving cache for successful job |
3m 25s | 51s | 1m 28s |
| Partial total (duration for other steps doesn't change) | 9m 40s | 2m 55s | 3m 43s |
If we stop caching .yarn-cache, we could already save 6m 45s in the Trigger:package job!