I have multiple CHEF cookbooks that I deploy. Each one is versioned according to semantic versioning.
My production environment is using cookbook 0.1.1
My stage environment is using cookbook 0.2.0
Version 2.0 has a large change that I can't deploy into production yet. A bug was found that needs to be hotfixed in 0.1.x. How would I create and deploy cookbook 0.1.2 to production, without merging in the big change in cookbook 2.0 into production?
Using git-flow. New releases are created off of the develop branch. Then merged back into develop and tested. After tests it is then merged to master, given a git tag and automatically deployed to the chef server.
0.1.1 0.2.0
/ \ / \
o-o--------o-o---X---o--------o-o-------- develop
\ \ \
o------------o------------------o------ master
When a cookbook is released, the release branch is deleted.
I assume I need to checkout X
and then create cookbook 0.1.2. However I find when I try and merge the cookbook 0.1.2 into the develop branch, the metadata.rb
and CHANGELOG.md
have merge conflicts (Y
). While I could rebase before the 0.2.0 cookbook was released, that would change my entire history.
_________________
/ \
0.1.1 0.1.2 0.2.0 \
/ \ / / \ \
o-o--------o-o---X---------o--------o-o------Y-- develop
\ \ \
o------------o------------------------o------- master
Whats the best way to deploy a older cookbook?
I know similar questions on backporting git commits have been asked on SO, but none of them cover how to handle the inevitable merge conflicts. Should I just accept that there will be conflicts and resolve them by hand?
Git strategy to backport bugfixes into older branches (cherry-pick vs. merge)
http://glicksoftware.com/blog/backporting-a-topic-branch-with-git
Update
To clarify, I already have a strategy for using different cookbook in different environments using an environments.json file and version pinning.