What is continuous integration?
Continuous Integration (CI) is a devops and software development practice where code is continuously integrated into the trunk (a shared repository also known as master or mainline) where these integrations are automatically built and tested.
By integrating controlled portions of code into the master branch more regularly, you can find bugs quickly and locate them more easily. Continuous Integration relieves the anxiety of hoping your code works when you merge it with everyone else’s because you’re confident of its status as it relates to the mainline.
Without CI, software developers have to work to finish the entire feature before merging it with the rest of the codebase. By the time a developer has merged it into the mainline, there have been so many changes that it causes what’s known as a merge conflict, or competing changes to the code. This causes friction in the development workflow because it sometimes takes hours to resolve and merge code written by different team members or teams.
Benefits of continuous integration
Increase development velocity
By applying continuous integration, organizations can increase development velocity because developers can isolate parts of their code to efficiently find bugs in their software projects and roll out new features to customers without creating fiction in the experience. Developers can integrate unfinished features into the master branch behind feature flags without risking instability.
Additionally, developers can work without having to worry about detangling messy merge conflicts. By using feature flags or feature toggles, features that are in-progress can be pushed into a shared branch without blocking release from that branch.
Improve product quality
When you check in code more frequently, you improve product quality because you’re running tests against that code multiple times a day and you’re not waiting for a giant build to pile up before attempting to integrate with everyone else’s work. The ability to control portions of code allows developers to focus on the quality of the code and ship faster and more confidently.
Strong code foundation
It’s unrealistic to imagine a world where you have 100% bug-free code, but having tools and processes in place to catch the most disruptive bugs is possible and should be part of the thinking as you implement continuous integration within your company. When practicing CI, teams have complete control and visibility over what’s being introduced into the codebase and can easily triage if a deployment has caused a bug.
Continuous integration tools
There are many CI tools available that can help developers to implement continuous integration into their software development process:
Source control - Source control and version control systems such as Git, Github (for open source software), Bitbucket, and Subversion serve as a code repository as well as a way to merge source code changes and resolve conflicts in code that is being integrated.
Automated tests - With the frequent code integration involved in the CI process, it's important to ensure the quality of the code that is being merged, so automated unit tests and test suites such as Jenkins and Selenium are crucial.
Build automation - Continuous integration tools also incorporate functionality that helps automate the build process so that builds are automatically launched by triggers such as when new code is merged into the mainline, a process called continuous deployment.
CI platforms - There are many many continuous integration platforms out there that help to manage many of the tasks involved in the CI process. Popular tools include CircleCI, Jenkins, Buddy, Gitlab CI, Travis CI, and Codeship.
Continuous integration vs continuous delivery
Continuous delivery (CD) is the software development process of getting code changes into production quickly, safely and with higher quality usually using tools to automate the deploys. Engineering teams make changes to their software in short cycles, so that it can be tested and released more frequently. This approach allows for incremental changes with both lower costs and risk.
In traditional software development, the process of integration occurs at the end of a project after each person finishes their work. This process can take a long time and be frustrating for all involved.
Continuous integration is a software development practice that moves the integration phase earlier in the development cycle so that developing, testing and integrating code happens with greater frequency. The development team merges code changes into a shared, central repository several times a day in order to release a product version at any moment. This requires an integration process which is reproducible and automated.
Continuous integration and continuous delivery are typically paired together as part of the agile development methodology, so much so that the combined acronym "CI/CD" is often used to describe the process.
Continuous integration and product experimentation
Running a successful experimentation organization requires the development team to work quickly and efficiently because of the need to iterate once your features have been used in real-world environments. Feature flags allow you to experiment with more confidence and not worry about having to change infrastructure or code if you want to enable or disable a feature.
To help keep A/B testing as a key part of your organization’s deployment process, Optimizely server-side experimentation integrates feature flags, rollouts, and variables with experimentation, allowing you to control the entire product development lifecycle in one place. By first running an A/B test to a portion of traffic, your team can test and gradually optimize a new feature. Once you have the best user experience, it can be rolled out in a controlled way across your entire customer base to reduce the risk of any engineering issues with the release process.