[chef] Re: Re: Workflows, librarian, cookbooks as individual git repositories, and other headaches


Chronological Thread 
  • From: Bryan Berry < >
  • To:
  • Subject: [chef] Re: Re: Workflows, librarian, cookbooks as individual git repositories, and other headaches
  • Date: Fri, 13 Apr 2012 11:07:22 +0200

tks Peter, braid looks like it could be an interesting wrapper around  git. I probably could build a rake task around it that meets my needs, will have to think about it some more

On Fri, Apr 13, 2012 at 8:47 AM, Peter Donald < "> > wrote:
Hi,

On Fri, Apr 13, 2012 at 4:20 PM, Bryan Berry < "> > wrote:
> I have pretty much settled on using librarian to manage to my cookbooks/
> directory, holding all of my 'vendor' cookbooks, i.e. cookbooks I don't
> actively modify and putting those cookbooks that I do actively edit into
> site-cookbooks/
>
> Each cookbook in site-cookbooks/ has its own git repository
>
> The pain arises  in the following situations
>
> 1. When I want to sync my setup from one workstation to another, i.e. b/w my
> workstation in the office and my laptop at home
> 2. End of the day I want to make that all my commits across various
> cookbooks in site-cookbooks are pushed to origin
> 3. I want my colleague to quickly be working on the same set of cookbooks
> that I am
>
> This doesn't seem like super hard stuff, but like so many problems in the
> Chef world, someone has probably already invented a cleverer solution than I
> would invent on my own.
>
> I have in mind a Rake task that searches site-cookbooks and pushs the latest
> commits to master
>
> But how would I make sure that my colleague and I have the same set of
> site-cookbooks/ ? Perhaps something like Cheffile or an addition to Cheffile
> that pulls specified cookbooks into site-cookbooks but doesn't take over the
> entire directory like librarian does with cookbooks/.

If you are working in a git repository I would highly recommend the
use of braid. With it you can essentially merge a remote repository
into a local repository (I believe under the covers it is just a git
subtree merge). Thus your local repository always has the complete
state of your system. If you want to push changes back to their origin
then that is possible to just push. These changes would appear in both
the local repository and the origin repository. Braid may not be chef
specific (and may not understand dependencies and versions) but it is
designed for this workflow and I think it is a far easier to use for
that sort of thing rather than a collection of more complex tools.

For example...

# import original data
braid add :realityforge-cookbooks/glassfish.git
cookbooks/glassfish
...
# update from original repository as it has changed
braid update cookbooks/glassfish
...
# make some changes in local repository
vi cookbooks/glassfish/...
git commit -a
...
# examine changes from origin repository
braid diff cookbooks/glassfish
...
# optionally push changes back to origin repository
braid push cookbooks/glassfish

I tend to not directly push back from the repository but may generate
diffs and manually apply the changes to the upstream cookbook. This
allows me to clean uyp patches when necessary and remove some cruft.

--
Cheers,

Peter Donald




Archive powered by MHonArc 2.6.16.

§