Search code examples
chef-infraberkshelf

Berkshelf: upload a wrapper cookbook and its dependencies to Chef Server simultaneously


I've made a simple wrapper cookbook for the community vim cookbook. It's called ws-vim. I wanted to upload it to my hosted Chef Server so I ran $ berks upload ws-vim from the cookbook directory where the Berksfile and Berksfile.lock are. This only uploaded my wrapper cookbook and when I viewed a role in the Chef Server that mentioned this cookbook it said the role couldn't be used because I was missing the vim dependency. Sure enough it hadn't been uploaded when I did the berks command.

I was under the impression that this would upload my wrapper cookbook and its dependencies as specified in Berksfile.lock all at the same time, similar to how $ berks install installs all my dependencies and my dependencies' dependencies at the same time.

Berks is great but what if I have a huge dependency tree? Do I really have to upload each cookbook to my Chef Server manually? Surely I'm missing something but I couldn't find anything in the docs/Google to help. Thanks in advance!!


Solution

  • Rather than berks upload ws-vim you just want to run berks upload (or maybe something like berks upload -e test if you're using the groups feature) from inside the ws-vim folder. This will do the full recursive upload for you. By passing a specific name you told it to upload only that cookbook and ignore dependencies. This can be useful in some cases (hotfix pushes, etc), but not usually what you want.