Principles of Continuous Integration (CI)

Principles of Continuous Integration (CI)

Continuous integration is a practice in which developers integrate codes in a shared repository multiple times in a day. Now think a group of developers are working on the same project. A developer changes the copy of the code base. Now when other developers submit code changes to the source code repository, the changes made by the previous developer stops reflecting. With codes being constantly changed, infrequent commits take place and testing becomes late. If a long branch of code is not checked it may lead to integration conflicts. When the developer branch is re-integrated with the main branch, bugs can percolate in/ The main repository becomes so different from the developers; branches that merging the changes becomes a hellish affair. So, many principles are there for successful continuous integration like 

  • Commit code frequently- It is important to commit code to the version repository regularly and frequently. Integrating early and frequently is the main principle of continuous integration 
  • Maintaining a single source code repository- Use a source code management system that can serve as the main source code repository. By using the source code management tools, you can keep the code in a centralised location from where developers can access the most updated version of the build mainline. All the scripts, property files, schema and libraries created by developers should be pushed to this centralised source code repository. 
  • Stop committing broken codes- You should detest from committing codes that fails tests or are non-functional. Developers should practice maintaining a private build before checking and pushing the code into the centralized repository. Developers should run the integration builds in their local development environment after code testing so as to prevent integration failures. 
  • Undertaking build automation- The build process should be automated in a CI environment. This would help building and launching the system using a single command of build scripts. The build process should include everything from sourcing the database schema from the central repository and employing it in the production environment. The build tools like Ant, MS build and Ruby Rake helps in build automation.  
  • Broken builds should be fixed as soon as possible- Mainline build can break anytime. For ensuring continuous integration we need to ensure that the mainline build is fixed immediately. The most effective way of fixing it is to undo the latest commit from the mainline 
  • Inducing self-testing capabilities in the build- Apart from the build being automated, the tests for the CI system must also be automated. Automated tests and methods like test driven development and extreme programming can test a huge chunk of codes for bugs. For running tests in an automated manner, the tests should be written in an xUnit framework like NUnit or Junit. In the CI system, it is necessary to ensure that 100% of the tests are passed before committing to the central code repository. Clogging the mainline with codes that have not passed all the automated tests will result in poor quality software. There are various coverage tools that helps in ensuring that every code is tested. 
  • Ensuring build of every commit on an integration machine- The frequent build should happen on an integration machine and the build should be successful for the commit to be considered done. Once a commit is successful, the CI server checks the source code on the integration machine and starts a build. A developer who has committed the latest code should be made responsible for checking the mainline build. The output/status of the build process should be notified through mail to one who has committed. 
  • Making latest executable version easily accessible to all- In the CI process, the latest executable version of the code must be made accessible to all the developers on the project 
  • Automating the deployment- It is important to automate deployments with scripts which helps in fastening the process and reducing errors. Provisions for rollback should be there as failure can occur anytime 
Get free consultation from our tech experts

Get free consultation from our tech experts

Schedule a discussion
Get free consultation from our tech experts
Get free consultation from our tech experts

Related Posts

Aligned to business domains to provide deep expertise to solving and enabling business units
Connect With Us

Request a Consultation