Aslan Brooke
Aslan Brooke

Reputation: 497

How to upload Chef cookbook from current directory?

I'm moving to a workflow of single git repository per chef cookbook. And I have a fairly recent chefdk. I'd like to be able to upload to chef from within the current git repo without a chef-repo behind it. I'm struggling to see how to do that with knife upload. Any ideas. (I can't move to PolicyFiles yet, but I'd like to setup a piece of the workflow now). Any ideas to just "knife upload" from within a git repo easily, would be helful.

Upvotes: 3

Views: 2761

Answers (2)

Mark O'Connor
Mark O'Connor

Reputation: 77951

I would recommend using berkshelf instead. It's part of the chefdk and will also load cookbook dependencies as well.

Example

#
# Generate cookbook
#
$ chef generate cookbook demo
$ cd demo

#
# Upload cookbook using Berkshelf
#
$ berks install
$ berks upload

#
# Check to see cookbooks loaded
#
$ knife cookbook list
demo   0.1.0

Upvotes: 2

Joe Nuspl
Joe Nuspl

Reputation: 56

I have a primitive alias "upload" that does knife cookbook upload ${PWD##*/} -o .. which will upload the current cookbook.

My directory names match the cookbook name defined in metadata.rb and I only run it from the root of the cookbook so it sufficient for my workflow.

Upvotes: 4

Related Questions