Skip to content

Instantly share code, notes, and snippets.

@fearoffish
Created April 18, 2011 15:31
Show Gist options
  • Save fearoffish/925561 to your computer and use it in GitHub Desktop.
Save fearoffish/925561 to your computer and use it in GitHub Desktop.

Start a feature branch based off the develop branch and do your changes.

git flow feature start some_new_things

Bump the version number of each cookbook you work on, major numbers are for api changes, minor numbers are for new features and release numbers are for bugfixes.

Environment files are where we control the version of cookbooks that run on each cluster of servers. So update your testing environment file with the new cookbook version numbers you changed.

Upload all cookbooks to push those to the Chef server. You will receive errors if you are overwriting cookbooks with the same version number.

knife cookbook upload -a

Update the testing environment file with the new cookbook version that you uploaded. For example, if you changed the application cookbook and bumped the version to 1.1.0, then change the testing environment to use that new cookbook version, and upload it.

knife environment from file testing.rb

Force a chef run on the testing server, check everything works as it should and repeat the above as necessary. Once you're done with changes commit those changes.

git commit -a -m "my one line change summary"

Finish your feature branch when you're confident that these changes are functional and safe.

git flow feature finish some_new_things

Pull the latest remote changes to a local branch.

git fetch origin develop

If there were changes, verify that your version number is different, otherwise merge in the changes and bump that version number again so you don't have a version number conflict.

git merge origin/develop

Upload all cookbooks, confident in the fact that only the testing server will have your new changes because of the awesome Chef environments feature.

knife cookbook upload -a

If everything is working as expected still, then it's time to push these to the staging environments. Start a release branch to document your changes.

git flow release start some_new_things

Update the CHANGELOG to reflect your changes.

Now change the staging environment file to use the new cookbook versions and commit those changes.

git add environments/staging.rb

Upload your cookbooks and freeze them. Freezing them tells the Chef server that we don't want these versions overwritten. To put in more changes we have to use a new version number now.

knife cookbook upload -a --freeze

Note the lack of the --force option If you get errors here then you either haven't updated the version numbers or another DevOp has uploaded new cookbooks. Investigate!

Once you're happy with the staging clusters, it's time to update the production cluster. Edit the production environment file with the new cookbook versions and upload it.

knife environment from file production.rb

Verify that the production clusters are functioning as expected and once you're happy commit the production environment file changes.

git add environments/production.rb
git commit -m "my one line change summary"

Finish your release branch

git flow release finish some_new_things

Push your changes.

git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment