bundler-cache with no Gemfile.lock: constant cache key restores stale vendor/bundle (broken gem payloads)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- github-actions, javascript, ruby
Hướng nghiên cứu
Look at the action's source code, likely in the lib/ or src/ directories, to find where the bundler-cache key is computed. The key currently uses hashFiles('Gemfile.lock'). Understand the GitHub Actions cache API. The fix involves detecting the absence of Gemfile.lock and either skipping the cache or generating a key from Gemfile, *.gemspec, and the commit SHA. Test the change in a fork with a repository that has no Gemfile.lock committed. 'Done' is when a CI run with a lockless workflow correctly installs gems without restoring a stale cache.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
With bundler-cache: true and no Gemfile.lock committed (lockless
workflow, e.g. lock deliberately untracked), the bundle cache key
degenerates: hashFiles('Gemfile.lock') is empty, so the
vendor/bundle cache key becomes effectively constant across runs and
dependency changes. Jobs restore a stale or partially-invalid
vendor/bundle from an arbitrary earlier run. In our case the restored
rspec-support gem was missing lib/rspec/support/source.rb, and the
run then crashed fatally inside rspec's summary formatter
(LoadError), hiding all real test failures.
Observed on
- ruby/setup-ruby@v1,
bundler-cache: true - Repository with
Gemfile.lockin .gitignore (CI re-resolves deps) - ubuntu 22.04, Ruby 3.3.12
- run: metanorma/uniword PR CI, 2026-09-24
Expected
When no Gemfile.lock exists, either:
- skip the bundle cache entirely (fresh
bundle installevery run —
slower but correct), or - derive the cache key from
Gemfile+*.gemspechashes and
git rev-parse HEAD(or the run id), so every dependency change
produces a distinct cache entry and stale bundles are never
restored.
A warning (::warning::) that the bundle cache was skipped/derated
for lockless workflows would also make the failure mode diagnosable.
Workaround we applied
rm -rf vendor/bundle in a pre-setup step (forces pristine install).
Versions
- ruby/setup-ruby@v1 (current main as of 2026-09-24)
- Bundler 4.0.x
- Ngôn ngữ chính
- JavaScript
- Star
- 990
- Fork
- 369
- Merge trung bình
- 1 giờ 5 phút
- Pull request đã merge (30 ngày)
- 5
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/setup-ruby
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
ruby/setup-ruby#818 · 6 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
ruby/setup-ruby#801 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
ruby/setup-ruby#791 · 3 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
ruby/setup-ruby#752 · 12 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
ruby/setup-ruby#673 · 3 bình luận · 1 reaction ·
Tất cả issue của ruby/setup-ruby
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
neondatabase/website#5944 ·
-
module: core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·