Best way to keep both chef-repo and cookbooks under source control?


#1

Anyone have any recommendations on the best way to keep both chef-repo and
cookbooks under source control?

My current thought is to keep cookbooks/ as a sub-directory of chef-repo/
but to put cookbooks/* in my top-level .gitignore for chef-repo

so

chef-repo/
.gitignore # inside; ignore cookbooks/*
cookbooks/
databags/

is there a better strategy?

Following previous discussions on this list, I will keep all
corporate/sensitive info in chef-repo and no corporate info (ip addrs,
hostnames, etc.) in cookbooks/


#2

If you plan on sharing your cookbooks or using them with more than 1
chef-repo, it’s not uncommon to keep them in another version control
repository and use the vendor-branch pattern to only bring in tagged
"releases" of your cookbooks. This allows development of the cookbooks
isolated from the deployment and makes using multiple chef-repos
feasible with a shared cookbook set.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Wed, Oct 12, 2011 at 11:16 AM, Bryan Berry bryan.berry@gmail.com wrote:

Anyone have any recommendations on the best way to keep both chef-repo and
cookbooks under source control?
My current thought is to keep cookbooks/ as a sub-directory of chef-repo/
but to put cookbooks/* in my top-level .gitignore for chef-repo
so
chef-repo/
.gitignore # inside; ignore cookbooks/*
cookbooks/
databags/

is there a better strategy?

Following previous discussions on this list, I will keep all
corporate/sensitive info in chef-repo and no corporate info (ip addrs,
hostnames, etc.) in cookbooks/


#3

I don’t have any direct help for you myself, but if you haven’t seen
the Working
with Git and Cookbookshttp://wiki.opscode.com/display/chef/Working+with+Git+and+Cookbooks
[1]
page on the Chef Wiki, you may want to check it out to see if there is some
detail that is helpful for your use.

On Wed, Oct 12, 2011 at 9:21 AM, Matt Ray matt@opscode.com wrote:

If you plan on sharing your cookbooks or using them with more than 1
chef-repo, it’s not uncommon to keep them in another version control
repository and use the vendor-branch pattern to only bring in tagged
"releases" of your cookbooks. This allows development of the cookbooks
isolated from the deployment and makes using multiple chef-repos
feasible with a shared cookbook set.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Wed, Oct 12, 2011 at 11:16 AM, Bryan Berry bryan.berry@gmail.com
wrote:

Anyone have any recommendations on the best way to keep both chef-repo
and
cookbooks under source control?
My current thought is to keep cookbooks/ as a sub-directory of chef-repo/
but to put cookbooks/* in my top-level .gitignore for chef-repo
so
chef-repo/
.gitignore # inside; ignore cookbooks/*
cookbooks/
databags/

is there a better strategy?

Following previous discussions on this list, I will keep all
corporate/sensitive info in chef-repo and no corporate info (ip addrs,
hostnames, etc.) in cookbooks/


#4

Thanks Matt,

I will read about the vendor-branch pattern through Tom’s link

Any suggestions on how to track my chef-repo? should I track it separately
from my cookbooks using .gitignore to keep it from tracking cookbooks/ ?

On Wed, Oct 12, 2011 at 6:21 PM, Matt Ray matt@opscode.com wrote:

If you plan on sharing your cookbooks or using them with more than 1
chef-repo, it’s not uncommon to keep them in another version control
repository and use the vendor-branch pattern to only bring in tagged
"releases" of your cookbooks. This allows development of the cookbooks
isolated from the deployment and makes using multiple chef-repos
feasible with a shared cookbook set.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Wed, Oct 12, 2011 at 11:16 AM, Bryan Berry bryan.berry@gmail.com
wrote:

Anyone have any recommendations on the best way to keep both chef-repo
and
cookbooks under source control?
My current thought is to keep cookbooks/ as a sub-directory of chef-repo/
but to put cookbooks/* in my top-level .gitignore for chef-repo
so
chef-repo/
.gitignore # inside; ignore cookbooks/*
cookbooks/
databags/

is there a better strategy?

Following previous discussions on this list, I will keep all
corporate/sensitive info in chef-repo and no corporate info (ip addrs,
hostnames, etc.) in cookbooks/


#5

I think it’s worth still checking the cookbooks into your chef-repos,
just don’t modify them there. When you vendor the cookbook, you’re
creating a local fork that tracks the upstream provider. Since you’re
the upstream provider for these, you can tag your internally vendored
cookbooks when importing, so you see if any changes are made after the
import (and strongly discourage that). Any needed changes can be made
upstream and pulled back into the chef-repos as necessary.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Thu, Oct 13, 2011 at 1:03 AM, Bryan Berry bryan.berry@gmail.com wrote:

Thanks Matt,
I will read about the vendor-branch pattern through Tom’s link
Any suggestions on how to track my chef-repo? should I track it separately
from my cookbooks using .gitignore to keep it from tracking cookbooks/ ?

On Wed, Oct 12, 2011 at 6:21 PM, Matt Ray matt@opscode.com wrote:

If you plan on sharing your cookbooks or using them with more than 1
chef-repo, it’s not uncommon to keep them in another version control
repository and use the vendor-branch pattern to only bring in tagged
"releases" of your cookbooks. This allows development of the cookbooks
isolated from the deployment and makes using multiple chef-repos
feasible with a shared cookbook set.

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Wed, Oct 12, 2011 at 11:16 AM, Bryan Berry bryan.berry@gmail.com
wrote:

Anyone have any recommendations on the best way to keep both chef-repo
and
cookbooks under source control?
My current thought is to keep cookbooks/ as a sub-directory of
chef-repo/
but to put cookbooks/* in my top-level .gitignore for chef-repo
so
chef-repo/
.gitignore # inside; ignore cookbooks/*
cookbooks/
databags/

is there a better strategy?

Following previous discussions on this list, I will keep all
corporate/sensitive info in chef-repo and no corporate info (ip addrs,
hostnames, etc.) in cookbooks/