Skip to content

Fix caching of bundled gems in the Ruby.gitlab-ci.yml

  • Please check this box if this contribution uses AI-generated content as outlined in the GitLab DCO & CLA

What does this MR do and why?

In the default Ruby.gitlab-ci.yml template exists an incorrect configuration for caching of bundled gems, as a result, the consequent commits and triggered CI pipelines fetch and build Ruby gems instead of reading them from the cache:

$ bundle config set --local deployment true
$ bundle install -j $(nproc)
Fetching rake 13.2.1
Installing rake 13.2.1
Fetching bigdecimal 3.1.7
Fetching base64 0.2.0
Installing base64 0.2.0
Fetching concurrent-ruby 1.2.3
...

After this small fix, it works faster because reads gems from the cache:

$ bundle config set --local deployment true
$ bundle config set --local path './vendor/ruby'
$ bundle install -j $(nproc)
Using rake 13.2.1
Using base64 0.2.0
...

MR acceptance checklist

It speeds up automated tests passing

Screenshots or screen recordings

Before: https://gitlab.com/abratashov/kamal-blog-github/-/jobs/6646173877 2024-04-17_Before

After: https://gitlab.com/abratashov/kamal-blog-github/-/pipelines/1256617021 2024-04-17_After

How to set up and validate locally

  1. Just create two PRs with previous and current CI changes and check timing of pipeline running, e.g. https://gitlab.com/abratashov/kamal-blog-github
Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading