Pipelines: Caching between jobs/stages
Summary
When setting up GitLab CI Pipelines for a ruby project with a cache config for the vendor/ruby directory, in the next job/stage/etc the gems will be installed again instead of loaded from the cache. Same for every other directory (like node_modules).
Maybe I'm getting something wrong and you can help me to get the cache working.
Steps to reproduce
- Setup project
- Push some ruby project
- Create a
.gitlab-ci.yml(content below) - push
- See how the gems will be installed (
Installting xyzinstead ofUsing xyz) again for each job/stage/pipeline
Content of the .gitlab-ci.yml:
image: "ruby:2.4.0"
variables:
RAILS_ENV: "test"
GIT_DEPTH: "1"
cache:
key: "ruby-240"
paths:
- vendor/ruby
before_script:
- gem install bundler --no-ri --no-rdoc
- RAILS_ENV=test bundle install --path vendor --without development
stages:
- setup
- check
setup:
stage: setup
script:
- node -v
- ruby -v
- which ruby
- which bundle
- which bower
check:
stage: check
script:
- echo 'works'
What is the current bug behavior?
The specified directories are not cached between stages/jobs/... despite the log says Creating cache ruby-240... at the end and Checking cache for ruby-240... as well as Successfully extracted cache at the beginning.
What is the expected correct behavior?
Bundler should say Using instead of Installing due the fact that the vendor/ruby dir is cached. This should work at least between stages/job but also between pipeline builds. Otherwise the setup process of our builds take forever (10 minutes +), which is not just annoying but also a bigger load for the GitLab.com pipeline workers.
Output of checks
This bug happens on GitLab.com