Manage incremental releases to many nodes using git-bundle
Create a Git bundle from a clone of your product's Git repository by doing something along the lines of:
# assumes origin remote is a trusted git remote
git fetch origin
git bundle create rel-123.bundle \
origin/master...origin/develop
What this will do is (assuming you use this branching scheme) create a Git bundle file that contains just the Git objects necessary to apply what is on develop
onto the current master HEAD
(assumes master HEAD
is what is in production currently).
Ok, so what?
Well, now you just need to scp
(or whatever protocol you use to copy this file to all the nodes you need to deploy on) your rel-123.bundle
file to all necessary nodes and then you can do the following:
pushd /path/to/deployed/git/repo
git bundle verify /path/to/rel-123.bundle
git bundle unbundle /path/to/rel-123.bundle
popd
You can also do interesting things like:
git fetch /path/to/rel-123.bundle master:deploy
Essentially we are using the bundle file, /path/to/rel-123.bundle
, as if it is a remote in the above example.
I presented this technique first in 2011 at a local UG on distributed workflow using Git (slides available here: http://www.slideshare.net/mbbx6spp/distributed-developer-workflows-using-git). I used this technique as part of automated deployments previously with great success and plan on doing so again when relevant (i.e. for products with source artifacts rather than binary artifacts).