Deploy checklist

So your fancy new feature (and its code) has been reviewed, and you are ready to go live. Here’s what to do.

  1. Verify that the master branch is currently deployed. It should be, but if it isn’t check in with whoever has commited code without deploying it.
    1. Most likely the other commits are ready to be deployed and they will simply go out with your changes. But you should verify this with the committer.
  2. Rebase your branch on master. Resolve all the conflicts.
  3. Push your rebased branch. This will be a force push so take the appropriate precautions. As with all force pushes, you will need to co-ordinate with anyone else using this branch. We never force push master.
  4. Verify that CI passes.
  5. While waiting for CI, deploy your branch to a staging environment. Verify that the build and deploy are successful.
  6. Fast-forward master to match your branch. If you weren’t able to simply fast-forward, repeat the previous two steps (CI and staging). It is possible that something which was pushed to master since your original rebase causes problems that git-merge doesn’t pick up on.
    1. By fast-forwarding you will get the exact same git SHA as your branch. This means you won’t have to redeploy to staging. However, if you use Github’s “Rebase and merge” or “Squash and merge” buttons, then you will get a new git SHA. That means you’ll need to deploy the new SHA to staging before you can deploy to production.
  7. Deploy the exact commit you tested in staging to production.

When master is busy

If the master branch is busy, you can get into a loop of rebasing and re-testing that wastes a lot of time. In this case, use the following process to short-circut the loop.

  1. Complete steps 1-5 from above.
  2. Rebase your branch on master again. Resolve all the conflicts. Immediately fast-forward master to match your branch.
    1. Important: At this point master is not deployable. Do not walk away at this point. You must finish these steps.
  3. Verify that your commit (the exact SHA that is on master) passes CI.
  4. While waiting for CI, deploy your SHA to a staging environment.
  5. Deploy the exact commit you tested in staging to production.

Flowchart

Deploy process flow chart