The Pipeline Starts Before You Commit
So you’ve got a great continuous delivery pipeline runing on your build server, doing something like:
- Commit: unit tests, quality checks and coverage.
- Acceptance: longer running tests.
- Publish: deploys into production.
Not much more you can do to increase the quality of delivery right?
This week I’ve been working on some android development, and we have a pipeline similar to that described above. It dawned on me that the commit stage normally fails because tests haven’t been run, or some other easy to forget step. We really should insist on running these things before we push to master. Enter git service hooks.
With a small amount of scripting we have a pre-commit hook that:
- Compiles the code.
- Runs the unit tests.
- Checks your code coverage.
If anything fails, you are not allowed to commit the code.
This small enhancement has made it very difficult to fail the commit stage of the pipeline now. In fact the commit stage now only checks for environmental irregularities, or missing files. In essence, the pipeline starts before you commit