0

Using test-kitchen and Berkshelf, I'd like to capture & distribute my current cookbooks.

After telling teammates to install berkshelf, these options seem possible:

  1. retrieve cookbooks via the opscode repo per Berksfile cookbook
  2. run berks package to tar-ball all necessary cookbooks. Then, developers would unzip the tarball, then their Berksfile would retrieve each cookbook via cookbook X, path: 'cookbooks/X'
  3. ???

Which option is the best and why?

Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384

2 Answers2

2

Why do you want to distribute the cookbooks? The entire point of tools like Berkshelf/Bundler is so that you don't have to share cookbooks.

When you install your cookbooks with Berkshelf, Berkshelf will generate a lockfile. This lockfile contains the list of all the cookbooks and their location. Then you check in that lockfile to source control. When your teammates clone/update the repository, they will get that lockfile. When then run berks install, Berkshelf will honor all the constraints and versions from the lockfile.

Non-standard locations (i.e. path, github, svn, hg, etc) are highly discouraged. They make solving the graph nearly impossible and make your repository less portable.

See also:

Sources:

  • Core team
sethvargo
  • 26,739
  • 10
  • 86
  • 156
1

I suspect the best choice boils down to who you intend to distribute your cookbooks to.

  1. Other developers?
    • Simpliest solution would be to commit your Berkfile.lock alongside your code
    • Captures dependencies at a point in time
  2. 3rd parties
    • Create a tarball (using Berkshelf) and upload to a binary repository manager like Nexus.
    • Users can download an explicit copy of the cookbooks used in your chef server. Useful if customer is behind a corporate firewall.

Jamie Windsor discusses various approaches in his blog posting:

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • Thanks, Mark. So, let's say I do: `rm -rf Berksfile.lock && 'create & provision box'`. If that run works successfully, then I can commit my `Berksfile.lock` to source control to force developers to use a particular version? What if someone updates the `Berksfile`? Does that override the `Berksfile.lock`? Thanks – Kevin Meredith Apr 24 '14 at 14:59