test-kitchen / busser

Kitchen Busser - Runs tests for projects in test-kitchen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Serverspec Gem Breaks Older Chef Versions

gwynforthewyn opened this issue · comments

commented

Serverspec have released an updated gem which relies on a new version of net-ssh. The new version of net-ssh requires Ruby >= 2.0.

Older versions of Chef use Ruby < 2.0, so the installation fails.

I wasn't sure whether to report this here or against serverspec. It looks like the serverspec change was introduced pretty recently, and may well be this one mizzy/serverspec@35989d7. I'm only asserting that because serverspec has that commit tagged for 2.25, and that version of the gem was dropped into rubygems today. Unfortunately, I'm having difficulty figuring out whether the check there for ruby version is actually working as expected i.e. whether net-ssh ~> 2.7 is being installed or not.

My rationale for reporting this here is that it's the test-kitchen project that's breaking, so you're probably most invested right now. If there were a way to specify what versions of gems to install into the virtual machines, that'd provide a workaround for this for now.

kitchen verify default
-----> Starting Kitchen (v1.4.2)
-----> Verifying <default-oel-6-4>...
   Preparing files for transfer
-----> Busser installation detected (busser)
   Installing Busser plugins: busser-serverspec
   Plugins: busser-serverspec
   Plugin serverspec already installed
   Removing /tmp/verifier/suites/serverspec
   Transferring files to <default-oel-6-4>
-----> Running serverspec test suite
-----> Installing Serverspec..
   /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:388:in `ensure_required_ruby_version_met': net-ssh requires Ruby version >= 2.0. (Gem::InstallError)
    from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `install'
    from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:297:in `block in install'
    from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each'
    from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each_with_index'
    from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `install'
    from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/rubygems.rb:44:in `install_gem'
    from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/helpers.rb:57:in `install_gem'
    from /tmp/verifier/gems/gems/busser-serverspec-0.5.7/lib/busser/runner_plugin/serverspec.rb:60:in `install_serverspec'
    from /tmp/verifier/gems/gems/busser-serverspec-0.5.7/lib/busser/runner_plugin/serverspec.rb:33:in `test'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `each'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `map'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `invoke_all'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/group.rb:232:in `dispatch'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:115:in `invoke'
    from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:43:in `block in perform'
    from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:35:in `each'
    from /tmp/verifier/gems/gems/busser-0.7.1/lib/busser/command/test.rb:35:in `perform'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `each'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `map'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `invoke_all'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/group.rb:232:in `dispatch'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:115:in `invoke'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:40:in `block in register'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
   from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:359:in `dispatch'
    from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/base.rb:440:in `start'
    from /tmp/verifier/gems/gems/busser-0.7.1/bin/busser:8:in `<top (required)>'
    from /tmp/verifier/gems/bin/busser:23:in `load'
    from /tmp/verifier/gems/bin/busser:23:in `<main>'

Verify failed on instance .

commented

Does anyone know of an easy way to pin gem versions used by test-kitchen / busser when problems like this crop up?

I was able to work around this with a fork (modifying the gemspec), but fell like there should be a more acceptable way to do this.

CI tests should generally be repeatable, and most project gems are pinned, there should be a way to do the same for gem versions used by test-kitchen / busser as well.

commented

I ran my tests a few days ago and everything seemed fixed.

I agree with @neurogenesis that it'd be awesome if there was an easy way to pin versions, but I suspect that's a separate feature request. It seems like testkitchen is a conglomeration of other projects, made to work together really well, so I suspect it isn't a trivial judgment call how to implement version pinning.

You can pin gems in a busser run by adding a Gemfile to your test/integration/suite/serverspec directory. I think we could definitely use some documentation around this.

We can document this better in the parent project but it is documented here https://github.com/test-kitchen/busser-serverspec#-specify-serverspec-version

commented

It should definitely work with chefdk

ditto, definitely works

commented

👍 thanks guys!