Question

Right now I'm using Berkshelf to pull cookbooks from either my local repository or from community cookbooks that I'm using (e.g java / rvm etc).

I'm transitioning my projects from using forked community cookbooks to having berkshelf pull directly from github.com. The problem is that there's no versioning on the community cookbooks. I can't tell berkshelf that I'm using an old version of a community cookbook because it simply does not exist on github. There's no branching for versions or anything related to that. I could simply fork the repo by looking at the commit log (for the desired version) but that's additional overhead (maintaining the fork) I'm trying to get away from.

What's the most optimal solution? It sounds wrong to me that berkshelf cant fetch older versions from somewhere for community cookbooks.

Was it helpful?

Solution

The community cookbooks are versioned.

The site directive at the top of your Berkshelf file will download community cookbooks from the URL "http://cookbooks.opscode.com/api/v1/cookbooks":

site :opscode

cookbook "xxxx", "1.0"
cookbook "yyyy", "2.0"

As Seth points out this is better than retrieving from github as it ensures you're getting the released version. Another benefit is that transitive dependencies will be automatically retrieved.

The community cookbooks are release managed using tags. If you really, really, really wanted to keep retrieving them direct from github, you could do the following:

cookbook "artifact", github: "opscode-cookbooks/mysql", tag: "v4.0.14"

It would be great if all cookbooks in github following opscode's example. Then when we use them as dependencies we'd know which commit represents the actual version stated in the metadata file....

OTHER TIPS

Right, that's why you shouldn't use cookbooks from SCM locations. Instead, use api.berkshelf.com for community cookbooks.

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