Sometimes we consider a change so small that it can’t possibly break an app; so we don’t run any tests. One fine day, the product stops functioning and nobody knows why. To avoid this scenario, we thought of automating testing and deployment, which are two main integral parts of web deployment using a solution called Continuous Integration and Continuous Delivery (CICD).
- Continuous Integration deals with testing each change done to the codebase automatically and as early as possible
Principles of CI:
· Automate the Build
· Keep Build fast
· Automate testing of each Build
· Everyone can see what’s happening
- Continuous Deployment follows the testing that happens during Continuous Integration and pushes changes to a staging or development system
Principles of CD:
· Automate the Deployment
· Validating on production-like environments
As part of this, we integrated Jenkins (an open source tool) with GitHub to test every time the changes in the code are pushed to the source repository and following this, push the code to the app server automatically without any human intervention.
Advantages of implementing CICD:
- Running all tests immediately for every change by which we know right away if something broke
- Sending notifications for every success/failure of a job. Notification can be sent through emails or any kind of reporting/communication tools like Jira, Slack, Hipchat, etc.
- Developers can focus more on writing the code and less on monitoring the server
The goal of CICD is to get, the new features and fixes included in the code, to the users as soon as possible.
Continuous delivery is generally recommended for development and staging environments.
Flow Diagram of CICD: