[chef] Re: Cookbook workflows


Chronological Thread 
  • From: Harlan Barnes < >
  • To:
  • Subject: [chef] Re: Cookbook workflows
  • Date: Sat, 04 Feb 2012 15:09:26 -0500

On 01/31/2012 02:48 PM, Brad Knowles wrote:
On Jan 31, 2012, at 1:31 PM, Jesse Campbell wrote:

This is interesting to me, would be great to add that to the workflow
before pushing an update, make sure someone else on the team didn't
submit and forget to commit

For me, the big thing is that all the cookbook workflow tools I've seen so 
far integrate only with git, and that doesn't help us with svn.  It would be 
nice if we could have tools that would help us with svn today, and once we do 
make the cutover will continue to work for us under git.

Otherwise, I get to put together my own bash scripts to do what is required, 
because I don't have enough time to learn enough Ruby to be able to write 
proper plugins of my own.


I'm in the same place. Except I broke down and wrote the bash script (quicker than me learning the knife and ruby stuff to make a plugin ... although I want to do that eventually.)

Here's my script. It *should* do for subversion what (I think) knife cookbook site install does for git:

https://gist.github.com/1739757

It presumes an SVN repo structure of:

/
  tags/
  branches/
  trunk/
    chef-repo           # your "active" repo
      cookbooks/
  vendor
    cookbooks/          # all the cookbooks downloaded by knife
      zabbix
        current
        0.0.19
        0.0.20
        0.0.21
          attributes
          recipes
          ...

But could be changed pretty easily. You have to run it from wherever your "knife" command would find your knife.rb (if you have multiple repos, etc.)

Here's the basic steps it takes (somebody tell me if this is wrong)

1. fetch the cookbook with knife
2. check the version. if we already have the version in svn, we are done.
3. if we don't have that cookbook in the svn repo at all, import it to the vendor/cookbooks/<cookbook-name> 'current' dir (and tag it in the same sub-dir as it's version number.)
4. If we already have another version in current, it calls the svn utility svn_load_dirs (it comes with the subversion package in Ubuntu) to do the multi-step foo required to get get vendor/cookbooks/<cookbook-name>/current up to the latest version.
5. If the cookbook exists in my "real" chef-repo/cookbooks, then it does a merge. If it doesn't, it just does an initial copy.

I got most of this info from here:

http://svnbook.red-bean.com/en/1.6/svn.branchmerge.basicmerging.html


  • [chef] Re: Cookbook workflows, Harlan Barnes, 02/04/2012

Archive powered by MHonArc 2.6.16.

§