Steps for Continuous Deployment
When we come across the thought of continuous deployment, may see the larger result where developer pushes code and it gets deployed immediately. While that's the ultimate goal, reaching there is not by taking a leap. The baby steps, in slow pace, as I'd follow.
This post is absolutely for beginners and brief.
Step 1. Do git fetch origin master && git reset hard origin/master
on production, instead of git pull
Step 2. Do git reset to new timestamp folder and make a symlink to it, in the end of deployment. This is mini capistrano style. Current, releases directory.
Step 3. Make capistrano/fabric/shell file for deploy. Manually run the command whenever we want to deploy.
Step 4. Whenever something is pushed into github, make a new release tag, have a webhook to run the above script.
So, now, we've achieved master push => Deploy
part automated. Push to master is expected only after proper testing.
Mostly, the issues to get struck here are database migrations, timestamp based deployments, etc. It's okay, to say merge into master only when you want to deploy (set a cron). In case of rollback, make sure you've scripts ready to do it.
Step 5. Minor releases and major releases. If the code to master comes from release branch, major release. bugfix/hotfix -- minor release.
Step 6. Test coverage. If major release, run all tests. If minor release, run only limited relevant tests. It's fine if tests are very less but keep it in process so that you can move in desired direction.
Step 7. Merge branches automatically. Irrespective of tests passing or failing, merge the branches. Assume that QA is still functioning the same as step 1.
Step 8. Make sure minor releases tests are passing.
Step 9. Make sure major releases tests are passing. Test Coverage here can be very low, and its fine.
Step 10. Increase test coverage, gradually. Decrease manual testing steps, gradually. This can take months and its fine.
Step 11. When QA is completely fine with automated test suites that they have only User Acceptance testing to be done, is the point where you introduce continuous integration.
Achieving continuous deployment should be first step towards quality release management.
Hope this helps.