I sometimes get to advocate the practice Continuous Integration and Delivery as part of a DevOps culture. Mostly for developers but sometimes managers and testers. If you ended up here then you most likely have some idea on what it is about, but to be sure even the business people are in on it let’s rehash the components that make up Continous Integration, Delivery and Deployment. As can be read from the words of everyones favourite self-declared loud-mouth on the design of enterprise software Martin Fowler. This is a process that can be split into a these key components.
- Keep a single source code repository
- Have one long-living mainline and keep the number of branches short
- Automate a self-contained build towards the mainline
- Automate tests as part of the build and thus make it self-testing, avoid end to end tests.
- Everyone commits to mainline every day
- Every commit should build the mainline on a machine separate from the team
- Broken builds are fixed immediately
- Keep the Build Fast
- Test in a clone of the production environment
- The latest executable or artifact is easy to find and start or deploy
- Everyone can see what is happening
Adds a final step to the continuous integration cycle that makes sure that the mainline is always deployed to a test-system whenever something is merged into mainline. Alternatively it is very easy to make an automated deployment from a particular feature branch or released version.
Everything that is merged into mainline eventually goes into production if it passes all the tests, quality checks with all its bells and whizzles.
What’s the big deal?
CI/CD is intended not just to speed up development, but to help coordinate it. Having a shared
mainline from which all new feature branches are created allows for an obvious point of integration and short-lived branches. If you always build what is going in to the mainline and always build what is on the
HEAD then you have an automatic system that builds trust and supports the developers. This allows merging code into the mainline several times a day because you dare to do it. You dare to do it because there is a built trust that the system will be unforgiving if you do something stupid. I’d like tos uggest that it then acts as a
shared truth between all developers that use it.
This shared truth is a powerful tool when it is stable and proven within a team. It allows the team to focus on what is important, features, because it can trust that the build will stop them from doing something stupid that breaks the tests or introduces unneccesary technical debt. But only as long as
the build is fast, doesn’t produce
every commit is built. A flaky build, with tests that toggles or works half of the time undermines the shared truth, because if it can no longer be trusted then it is not really truth. Exactly like people, if they sometimes speak the truth and sometimes lie, then you cannot trust them. But if you have an impeachable person in your team who you can really trust to always rightfully stop you from doing something stupid, then that will truly empower a team.