Continuous Integration, Delivery and Deployment
In the old way of software delivery, most of the time is spent in software development, the whole application is delivered without even running it for once and is then deployed for the testing phase.
Testing is done for a large batch of software. Bugs are reported late in this process, and if because of some bug the deployment fails and it becomes tough to identify the exact reason for its cause.
In Continuous Integration, when in the application that you are working upon, on every code commit by a developer a build is created automatically, Unit tests are run, code metrics are calculated, artifacts are created and the application is deployed in the test-like environment.
Continuous delivery is to do automation and integration testing on every build to catch early issues in the build.
Continuous Deployment extends continuous delivery, after completion of automated testing the code is deployed to the production.
Image Source – Prowareness India
One of the key reason for using this type of implementation process is that it reduces the time it takes to deliver the product in the market.
In 2016 survey report, it was found that a high performing software development company, deploys the application on-demand basis as compared to the old process which took days or weeks to deploy the application which improves mean time to recover.
Another reason for using continuous integration, delivery and deployment is that it increases quality as inspection happens quickly instead of doing it in the end.
It also shortens the lead time for changes, in other words, it reduces the task in progress and study say a large number of tasks in progress is dangerous for quality.
The goal of continuous integration is that software is in working state all the time.
Practices to follow for Continous Integration:
- The Build should be executed in less time (less than 5 min), though its just a number and may vary depending on your application, it should be less.
- Commit small code – the little amount of code is easy to debug and inspect.
- Don’t leave the build broken.
- Use trunk based or branch based development process.
- Don’t allow flaky tests. Fix Them. Flaky tests are those who sometimes fail not always. Fixing them is equally important.
- The build should return to a state, a log and an artifact.
Practices to follow for Continous Delivery:
Continuous delivery is the practice of deploying the application in production like environment, perform automated integration testing and acceptance testing.
- Only build artifacts once.
- Artifacts should be immutable.
- Deployment should go to the production-like environment before deploying to production to do acceptance testing.
- Stop deployment, if a step fails.
- Deployments should be idempotent i.e redeploying should leave your system in the same way as before.
Types of testing which can be performed:
- Unit Testing – Unit tests can be performed just after the build is formed.
- Code Hygiene – to check the code formatting and banned function checks.
- Integration Testing – In this testing test cases are performed in an integrated environment.
- TDD (Test Driven Development), BDD (Behavior-driven development) and Acceptance test driven development are some of the functional test cases which can be performed.
- Performance Testing.
- Security Testing.
Different tools used at various stages of CD:
- Version Control – version control tool is used to maintain the versions of a build.
- CD pipeline tool – Jenkins, Go CD, VSTS and Bamboo are some important tools in this area.
- Build tools – depends on the programming language – maven is famous with Java, TFS is famous with dotNet or C#.
- Unit Testing tools – again depending on the programming language, JUnit is used for Java, NUnit is for C# etc.
- Integration Testing – Robot framework, Cucumber along with Selenium are famous in this region.
- Performance Testing – JMeter and Apache test are famous open source tools.
For more details on continuous delivery, you can go through a book called Continous Delivery by Jez Humble or follow this link.
PS: For any questions, queries, and feedback, feel free to write us at email@example.com or firstname.lastname@example.org. Happy Learning 🙂