bundler-cache with no Gemfile.lock: constant cache key restores stale vendor/bundle (broken gem payloads)
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 65/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- github-actions, javascript, ruby
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- JavaScript
- Estrelas
- 990
- Forks
- 369
- Merge médio
- 1h 5min
- PRs com merge (30d)
- 5
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ruby/setup-ruby
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
ruby/setup-ruby#818 · 6 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
ruby/setup-ruby#801 · 3 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
ruby/setup-ruby#791 · 3 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
ruby/setup-ruby#752 · 12 comentários ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 38/100
ruby/setup-ruby#673 · 3 comentários · 1 reação ·
Todas as issues de ruby/setup-ruby
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
mksglu/context-mode#1200 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
neondatabase/website#5944 ·
-
module: core
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
jaegertracing/jaeger-ui#4506 ·