Another Environment Cookbook pattern question

So, we are migrating to use the Environment Cookbook Pattern as described by Jamie Windsor on that now famous post for vial studios.

While most of the things are pretty clear, there’s a situation here that I would like the input from other people using similar strategies.

Given that you may have a lot of environment cookbooks and even more environments, what do youse do when you have to update a cookbook that is used on all environments.

My example here is the base cookbook, that is added to all environments. When the base cookbook receives an update, how do you go around updating all your environment cookbooks and redeploy them? Or just update the ones affected by the change (that sounds like a terrible idea)

I am thinking on how to do that management via CI, so opinions are welcome.

Thanks!

@coredump, My team used to use the Environment Cookbook and since switched to PolicyFiles but in both cases I have setup a Jenkins system that will do the following:

  • Pull from source control
  • Using Knife upload to push the changes to the chef server
  • using “knife winrm” or PowerShell Invoke-Command to run chef-client on remote machine

When the push of the updated cookbook goes up to the chef server it will automatically pull that cookbook the next time the chef-client run happens. Unless you are version locking the cookbooks. So if you are doing that you can probably have a step in Jenkins that will figure out the current uploaded cookbook version for the base and update the metadata.rb file with the correct version

We use very similar steps as outlined by stonesbg, but we are using TeamCity instead of Jenkins. Once the CI build is complete in TeamCity we use a PowerShell script to update an attributes.rb file (with changes) then upload to the Chef server as part of its cookbook, and then call Chef to run the deployment.