Skip to content

Bundler auto-upgrade issue after release 3.0.3 when BUNDLE_PATH is set #21

@richard-kramer

Description

@richard-kramer

I ran into this issue in our CI pipeline running within a ruby docker image and with BUNDLE_PATH set for caching.

Before the upgrade of appraisal2 to v3.0.3 everything worked without problems. Since then, bundle exec appraisal install seems to not automatically switch to the correct version of bundler. An because I have my bundler version pinned within the Gemfile to support upgrading it via Renovate, the install fails.

Here is a minimal reproduction using the exact dependencies I use. Setting APPRAISAL_VERSION=3.0.2 works, but APPRAISAL_VERSION=3.0.3 fails with Your bundle requires a different version of Bundler than the one you're running. Unsetting BUNDLE_PATH also works with both versions (but BUNDLE_PATH= (empty) still fails)

Excuse the convoluted setup, but I wanted exact Gemfiles and Gemfile.lock files for a accurate reproduction.

docker run \
  -e BUNDLE_PATH=/tmp/bundler \
  -e APPRAISAL_VERSION="3.0.3" \
  --rm \
  ruby:4.0.1-alpine@sha256:7d1c4a23da9b3539fdeb5f970950a8fe044a707219e546f12152b84bbd5755d1 \
  sh -ec '
  echo "source \"https://rubygems.org\"; gem \"appraisal2\", \"$APPRAISAL_VERSION\"; gem \"bundler\", \"4.0.6\"" > Gemfile

  echo "GEM
  remote: https://rubygems.org/
  specs:
    appraisal2 ($APPRAISAL_VERSION)
      bundler (>= 1.17.3)
      rake (>= 10)
      thor (>= 0.14)
    rake (13.3.1)
    thor (1.5.0)

PLATFORMS
  ruby
  x86_64-linux-musl

DEPENDENCIES
  appraisal2 (= $APPRAISAL_VERSION)
  bundler (= 4.0.6)

BUNDLED WITH
  4.0.6" > Gemfile.lock

  echo "appraise(\"test\") { gem \"logger\" }" > Appraisals
  
  mkdir -p gemfiles
  echo "source \"https://rubygems.org\"; gem \"appraisal2\", \"$APPRAISAL_VERSION\"; gem \"bundler\", \"4.0.6\"; gem \"logger\"" > gemfiles/test.gemfile

  echo "GEM
  remote: https://rubygems.org/
  specs:
    appraisal2 (3.0.2)
      bundler (>= 1.17.3)
      rake (>= 10)
      thor (>= 0.14)
    logger (1.7.0)
    rake (13.3.1)
    thor (1.5.0)

PLATFORMS
  ruby
  x86_64-linux-musl

DEPENDENCIES
  appraisal2 (= 3.0.2)
  bundler (= 4.0.6)
  logger

BUNDLED WITH
  4.0.6" > gemfiles/test.gemfile.lock

  bundle install
  bundle exec appraisal install
'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions