Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top