Repository navigation
Multiple workflow jobs with same ruby - Bundler cache issue? #801
Description
Activity
Recently I noticed logs for the CI run loading a 'close key' match cache, and it logged removing all the Rails gems.
In theory that should be fine, because it would just create a new cache from the existing cache. Did it cause any issue?
Do you have any log of that?I suppose we could include the workflow name (ideally the YAML file name and not user-provided name) into the cache key, probably that's a sensible solution, PR welcome.
Did it cause any issue?
No. Just seemed like a waste. I guess it's a distinction between storing more caches on GHA or hitting RubyGems.org more...
Example, which will disappear sometime soon.
https://github.com/puma/puma/actions/runs/17436777368/job/49508712527#step:5:138
I'll look into a PR.
Copying it here for posterity.
Looks fine, though the output is somewhat confusing withCache hit forbut actually using the cache from another key.
AlsoPrint lockfile took 21.08 sis a bit confusing, that's probably the time for the whole Bundler section.> bundle install /home/runner/.rubies/ruby-head/bin/bundle config --local path /home/runner/work/puma/puma/vendor/bundle /home/runner/.rubies/ruby-head/bin/bundle lock Writing lockfile to /home/runner/work/puma/puma/Gemfile.lock Fetching https://github.com/rack/rack Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Cache key: setup-ruby-bundler-cache-v6-ubuntu-22.04-x64-ruby-head-wd-/home/runner/work/puma/puma-with--without--only--ABI-3.5.0+3-Gemfile.lock-d9b4bae730cb042bc36b1f43d98b5ec596ee8a975418faa225c540a7e01a36d4 Cache hit for: setup-ruby-bundler-cache-v6-ubuntu-22.04-x64-ruby-head-wd-/home/runner/work/puma/puma-with--without--only--ABI-3.5.0+3-Gemfile.lock-d9b4bae730cb042bc36b1f43d98b5ec596ee8a975418faa225c540a7e01a36d4 Received 0 of 210078300 (0.0%), 0.0 MBs/sec Received 71303168 of 210078300 (33.9%), 34.0 MBs/sec Received 117440512 of 210078300 (55.9%), 37.3 MBs/sec Received 117440512 of 210078300 (55.9%), 28.0 MBs/sec Received 117440512 of 210078300 (55.9%), 22.4 MBs/sec Received 121634816 of 210078300 (57.9%), 19.3 MBs/sec Received 210078300 of 210078300 (100.0%), 28.4 MBs/sec Cache Size: ~200 MB (210078300 B) /usr/bin/tar -xf /home/runner/work/_temp/862c632a-6de3-4897-b536-85eb4e6f60ee/cache.tzst -P -C /home/runner/work/puma/puma --use-compress-program unzstd Cache restored successfully Found cache for key: setup-ruby-bundler-cache-v6-ubuntu-22.04-x64-ruby-head-wd-/home/runner/work/puma/puma-with--without--only--ABI-3.5.0+3-Gemfile.lock-02cc8abe637ec7f39bbe9a64ee3f6bfb59c3cb60c6942f35e2449c94921667f1 /home/runner/.rubies/ruby-head/bin/bundle install --jobs 4 Fetching gem metadata from https://rubygems.org/........ Fetching json 2.13.2 Fetching localhost 1.6.0 Fetching method_source 1.1.0 Fetching minitest-stub-const 0.6 Installing method_source 1.1.0 Installing localhost 1.6.0 Installing minitest-stub-const 0.6 Installing json 2.13.2 with native extensions Fetching rake-compiler 1.3.0 Fetching minitest-proveit 1.0.0 Fetching minitest-retry 0.2.5 Installing rake-compiler 1.3.0 Installing minitest-proveit 1.0.0 Installing minitest-retry 0.2.5 Fetching m 1.6.2 Installing m 1.6.2 Bundle complete! 15 Gemfile dependencies, 17 gems now installed. Bundled gems are installed into `./vendor/bundle` 1 installed gem you directly depend on is looking for funding. Run `bundle fund` for details /home/runner/.rubies/ruby-head/bin/bundle clean Removing actioncable (8.0.2.1) Removing actionmailbox (8.0.2.1) Removing actionmailer (8.0.2.1) Removing actionpack (8.0.2.1) Removing actiontext (8.0.2.1) Removing actionview (8.0.2.1) Removing activejob (8.0.2.1) Removing activemodel (8.0.2.1) Removing activerecord (8.0.2.1) Removing activestorage (8.0.2.1) Removing activesupport (8.0.2.1) Removing addressable (2.8.7) Removing base64 (0.3.0) Removing benchmark (0.4.1) Removing bigdecimal (3.2.3) Removing builder (3.3.0) Removing byebug (12.0.0) Removing capybara (3.40.0) Removing connection_pool (2.5.4) Removing crass (1.0.6) Removing cuprite (0.17) Removing date (3.4.1) Removing drb (2.2.3) Removing erb (5.0.2) Removing erubi (1.13.1) Removing ferrum (0.17.1) Removing globalid (1.2.1) Removing i18n (1.14.7) Removing importmap-rails (2.2.2) Removing io-console (0.8.1) Removing irb (1.15.2) Removing loofah (2.24.1) Removing mail (2.8.1) Removing marcel (1.0.4) Removing matrix (0.4.3) Removing mini_mime (1.1.5) Removing mini_portile2 (2.8.9) Removing net-imap (0.5.10) Removing net-pop (0.1.2) Removing net-protocol (0.2.2) Removing net-smtp (0.5.1) Removing nokogiri (1.18.9) Removing pp (0.6.2) Removing prettyprint (0.2.0) Removing psych (5.2.6) Removing public_suffix (6.0.2) Removing racc (1.8.1) Removing rack-session (2.1.1) Removing rack-test (2.2.0) Removing rails (8.0.2.1) Removing rails-dom-testing (2.3.0) Removing rails-html-sanitizer (1.6.2) Removing railties (8.0.2.1) Removing rdoc (6.14.2) Removing regexp_parser (2.11.2) Removing reline (0.6.2) Removing rexml (3.4.2) Removing securerandom (0.4.1) Removing sprockets (4.2.2) Removing sprockets-rails (3.5.2) Removing sqlite3 (2.7.3) Removing stringio (3.1.7) Removing thor (1.4.0) Removing timeout (0.4.3) Removing tzinfo (2.0.6) Removing uri (1.0.3) Removing useragent (0.16.11) Removing webrick (1.9.1) Removing websocket-driver (0.8.0) Removing websocket-extensions (0.1.5) Removing xpath (3.2.0) Removing zeitwerk (2.7.3) Removing puma (b813cfb5d4c1) Saving cache /usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/puma/puma --files-from manifest.txt --use-compress-program zstdmt Sent 0 of 166342963 (0.0%), 0.0 MBs/sec Sent 32125235 of 166342963 (19.3%), 15.3 MBs/sec Sent 166342963 of 166342963 (100.0%), 72.7 MBs/sec Took 21.07 seconds Print lockfile took 21.08 s
Puma runs several workflow files, and there is overlap between the Ruby versions. For example, Ruby head is used in both the Puma CI workflow and a workflow that tests with turbo-rails. The turbo-rails workflow installs Rails.
Recently I noticed logs for the CI run loading a 'close key' match cache, and it logged removing all the Rails gems. Or, with multiple jobs with matching Ruby vesions, the cache may have .misses'.
I added more info to the key with
cache-version(see https://github.com/puma/puma/pull/3726/files), but there might be a better way.Not sure if anyone else has run into this issue.