I would like to knife upload
in a post-receive hook of a cookbook repository. However, we have too many cookbooks to simply upload all of them anytime a change is made.
Is there a way to knife upload
only changed cookbooks?
Sounds like you have all your cookbooks in the same repo. You can use git diff
to determine the changes between HEAD and the previous commit and knife upload those results.
git diff --name-only HEAD HEAD~1 | awk -F '/' '{ print $1 }' | sort | uniq | xargs -I % knife cookbook upload %