Branches as an alternative to environments?

Has anyone thought about using git branches as an alternative to environments?

  • Branches already provide a nice mechanism for associating a
    particular set of cookbook/role/data_bag versions together as a named
    thing.
  • git push chef-server master (ala heroku deploy) besides being really
    cool, could be really fast as well.
  • Using a branch keeps me from having to maintain cookbook version
    numbers manually.

Thoughts?

This is what I do myself; since I have separate chef servers for
development, staging and deployment, it works great for me.

On Thu, Feb 24, 2011 at 10:20 AM, Michael Hale mikehale@gmail.com wrote:

Has anyone thought about using git branches as an alternative to
environments?

  • Branches already provide a nice mechanism for associating a
    particular set of cookbook/role/data_bag versions together as a named
    thing.
  • git push chef-server master (ala heroku deploy) besides being really
    cool, could be really fast as well.
  • Using a branch keeps me from having to maintain cookbook version
    numbers manually.

Thoughts?

Personally, I prefer to keep my cookbooks and roles the same across
environments, and mediate differences via data_bags. The branches in my
cookbooks repo are works in progress, and will eventually be merged back
into master. I have not yet looked at how environments are implemented in
0.10, however.

On Thu, Feb 24, 2011 at 11:20 AM, Michael Hale mikehale@gmail.com wrote:

Has anyone thought about using git branches as an alternative to
environments?

  • Branches already provide a nice mechanism for associating a
    particular set of cookbook/role/data_bag versions together as a named
    thing.
  • git push chef-server master (ala heroku deploy) besides being really
    cool, could be really fast as well.
  • Using a branch keeps me from having to maintain cookbook version
    numbers manually.

Thoughts?

Hi,

Am 24.02.11 17:20, schrieb Michael Hale:

Has anyone thought about using git branches as an alternative to environments?

  • Branches already provide a nice mechanism for associating a
    particular set of cookbook/role/data_bag versions together as a named
    thing.

I do the switching based on the current active git branch OR through
environment variables which allows me a great flexibility (I have to
switch between different organizations and environments regularly)

This works with the default rake tasks of a cloned "chef-repo" e.g.

rake upload_cookbooks
rake roles
...

regards
Roland

On Thu, Feb 24, 2011 at 8:20 AM, Michael Hale mikehale@gmail.com wrote:

Has anyone thought about using git branches as an alternative to environments?

  • Branches already provide a nice mechanism for associating a
    particular set of cookbook/role/data_bag versions together as a named
    thing.
  • git push chef-server master (ala heroku deploy) besides being really
    cool, could be really fast as well.
  • Using a branch keeps me from having to maintain cookbook version
    numbers manually.

We have thought about it. Environments give you a couple of things
that are hard to get if you just use git - the ability to manipulate
the environment via an API (think about compliance or approvals
workflows), the ability to be agnostic of source control choices, etc.

As for needing to maintain cookbook version numbers, I think it's
likely that we'll start auto-incrementing the patch number on cookbook
upload, or something similar - the dependency resolver in 0.10 is
pretty great, and can easily deal with ~> style operations.

If you really want this functionality, you could get it with the
environments API - it would be a post-commit hook and a few API calls.

Best,
Adam

--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com