I'm using the latest gitlab (it auto-updates) and gitlab CI runner that uses Docker. The project in question in a Rails project, and I simply want to cache the deployed gems for future use. I thought it would be as easy as this .gitlab-ci.yml:

What's particularly frustrating is that this works in practice. I can clone my code twice, once to a/ and once to b/, and run bundle install --deployment in a/, copy a/vendor/bundle to b/vendor/bundle and then hop in b/ and run bundle exec rake test with no issues. I just can't figure out what's happening in the pipeline to not make this work.

Another interesting tidbit: if I make the test job run bundle install --deployment before trying to bundle exec rake test, it finishes very quickly (of course) and then works fine. I'd say it must be writing to some file that I also need to cache, but my local testing doesn't seem to. Until someone comes up with a better idea, I'll use that for my path forward.