chef-boneyard / chef-dk

DEPRECATED: A streamlined development and deployment workflow for Chef Infra platform.
Apache License 2.0
380 stars 170 forks source link

Incompatible bundler version when using test-kitchen with vagrant driver #218

Closed tknerr closed 9 years ago

tknerr commented 9 years ago

My Gemfile locks test-kitchen and kitchen-vagrant to a specific version:

...
group :integration do
  gem 'test-kitchen', '1.2.1'
  gem 'kitchen-vagrant', '0.15.0'
  gem 'serverspec', '2.0.0.beta6'
end

Yes, I know that ChefDK ships with a tested set tooling, but my projects are not all aligned with ChefDK so I need to stick with Gemfiles/bundler. So I'm using ChefDK's embedded Ruby as my main ruby for Chef development, i.e. bundled gem installs should go in there.

Now when I run bundle exec kitchen test I get this error:

D:\Repos\_github\bills-kitchen\target\build\repo\vagrant-workflow-tests\playground\sample-toplevel-cookbook>bundle exec kitchen test
-----> Starting Kitchen (v1.2.1)
-----> Starting Kitchen (v1.2.1)
-----> Cleaning up any prior instances of <default-ubuntu-1204>
-----> Destroying <default-ubuntu-1204>...
       Finished destroying <default-ubuntu-1204> (0m0.00s).
-----> Testing <default-ubuntu-1204>
-----> Creating <default-ubuntu-1204>...
       Vagrant experienced a version conflict with some installed plugins!
       This usually happens if you recently upgraded Vagrant. As part of the
       upgrade process, some existing plugins are no longer compatible with
       this version of Vagrant. The recommended way to fix this is to remove
       your existing plugins and reinstall them one-by-one. To remove all
       plugins:

           rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems

       Note if you have an alternate VAGRANT_HOME environmental variable
       set, the folders above will be in that directory rather than your
       user's home directory.

       The error message is shown below:

       Bundler could not find compatible versions for gem "bundler":
         In Gemfile:
           vagrant (= 1.6.5) x86-mingw32 depends on
             bundler (< 1.7.0, >= 1.5.2) x86-mingw32

         Current Bundler version:
           bundler (1.7.2)

       This Gemfile requires a different version of Bundler.
       Perhaps you need to update Bundler by running `gem install bundler`?

I could workaround it by downgrading the bundler that ships with ChefDK to 1.6.7, but since vagrant/chef is such a common use case I might be worthwhile to ship a compatible bundler out-of-the-box.

What do you think?

Environment: ChefDK 0.3.2

lamont-granquist commented 9 years ago

That error looks like it is coming from the underlying vagrant command which should be running out of vagrants bundle but it looks like its picking up gems from the outer bundle where you're exec'ing test-kitchen. That is probably vagrants problem since it needs to erase any ruby env options. Offhand I don't see where the problem would be in chef-dk.

danielsdeleo commented 9 years ago

Yeah, as far as I can tell, vagrant is probably not resetting the BUNDLE_GEMFILE variable. Even if we adjust the version in ChefDK, the problem would just come back when you upgrade Vagrant. If there's a non-brittle solution for this in ChefDK, we can reopen this, but I think the best fix would have to be applied to vagrant.

tknerr commented 9 years ago

This had been fixed in vagrant master a bit earlier and will come with 1.7 I guess: https://github.com/mitchellh/vagrant/commit/bb22a37ed1989403e25e889d913b512090a5737f