Berks & Kitchen Interaction


#1

Can someone clarify exactly how berks and kitchen interact in this scenario:

Cookbook under test: passenger_nginx_vhost_test

This is a cookbook to test an LWRP that I am writing in the cookbook
’passenger_nginx’

The ‘passenger_nginx’ cookbook is a dependency for passenger_nginx_vhost_test.

When I first ran kitchen converge, the Berksfile this pointed to git
which obviously lacked the LWRP, as I hadn’t written it, but once I
started working on the LWRP I updated the Berksfile to point to the
cookbook on disk:

$ grep passenger Berksfile
cookbook ‘passenger_nginx’, path: ‘/home/kitchen/passenger_nginx’

Upon running another kitchen converge, the cookbook on the test
instance was still the old one from git. I then bumped the version in
the passenger_nginx metadata and tried a converge again. Same effect.
In order to get the updated cookbook transferred to the test instance
I needed to run a manual berks update, which pulled in the newer
cookbook from disk, and was subsequently used by kitchen converge.

My expectation is that this intermediate berks update is unnecessary.

Am I missing something?


Stephen Nelson-Smith,
Founder, Principal Consultant,
Atalanta Systems Ltd,
Web: http://agilesysadmin.net
Twitter: @lordcope
Skype: atalanta.systems
Direct: +44 (0) 1329 550203
Mobile: +44 (0) 7917 101919

Atalanta Systems: The Agile Infrastructure Enablers
http://atalanta-systems.com


#2

Hi Stephen,

As I understand it, test-kitchen will run a berks install or berks vendor [1] to get your cookbooks into the right place, using the Berksfile.lock as a guide for what the currently locked versions of a cookbook are. But test-kitchen won’t ever do a berks update; this would be very bad to get brand new versions of your dependencies on every converge. berks update will keep the constraints in your Berksfile, but update your lockfile when it re-resolves the dependency.

[1] https://github.com/test-kitchen/test-kitchen/blob/master/lib/kitchen/provisioner/chef/berkshelf.rb#L64-L71

Hope this helps!

  • Martin

From: Stephen Nelson-Smith [stephen@atalanta-systems.com]
Sent: Saturday, September 20, 2014 6:45 AM
To: chef@lists.opscode.com
Subject: [chef] Berks & Kitchen Interaction

Can someone clarify exactly how berks and kitchen interact in this scenario:

Cookbook under test: passenger_nginx_vhost_test

This is a cookbook to test an LWRP that I am writing in the cookbook
’passenger_nginx’

The ‘passenger_nginx’ cookbook is a dependency for passenger_nginx_vhost_test.

When I first ran kitchen converge, the Berksfile this pointed to git
which obviously lacked the LWRP, as I hadn’t written it, but once I
started working on the LWRP I updated the Berksfile to point to the
cookbook on disk:

$ grep passenger Berksfile
cookbook ‘passenger_nginx’, path: ‘/home/kitchen/passenger_nginx’

Upon running another kitchen converge, the cookbook on the test
instance was still the old one from git. I then bumped the version in
the passenger_nginx metadata and tried a converge again. Same effect.
In order to get the updated cookbook transferred to the test instance
I needed to run a manual berks update, which pulled in the newer
cookbook from disk, and was subsequently used by kitchen converge.

My expectation is that this intermediate berks update is unnecessary.

Am I missing something?


Stephen Nelson-Smith,
Founder, Principal Consultant,
Atalanta Systems Ltd,
Web: http://agilesysadmin.net
Twitter: @lordcope
Skype: atalanta.systems
Direct: +44 (0) 1329 550203
Mobile: +44 (0) 7917 101919

Atalanta Systems: The Agile Infrastructure Enablers
http://atalanta-systems.com