Continuous integration is a software development process where developers integrate the new code they've written more frequently throughout the development cycle, adding it to the code base at least once a day. Automated testing is done against each iteration of the build to identify integration issues earlier, when they are easier to fix , which also helps avoid problems at the final merge for the release. Overall, continuous integration helps streamline the build process, resulting in higher-quality software and more predictable delivery schedules.
By definition, DevOps outlines a software development process and an organizational culture shift that speeds the delivery of higher quality software by automating and integrating the efforts of development and IT operations teams – two groups that traditionally practiced separately from each other, or in silos.
In practice, the best DevOps processes and cultures extend beyond development and operations to incorporate inputs from all application stakeholders - including platform and infrastructure engineering, security, compliance, governance, risk management, line-of-business, end-users and customers - into the software development lifecycle.
In the DevOps framework, continuous integration sits at the beginning of the software development process, where you check in your code at least once a day to keep your local copies from drifting too far away from the main branch of the code build. This helps you avoid disastrous merge conflicts that could "break" the build and take the team hours or days to resolve.
Continuous integration serves as a prerequisite for the testing, deployment and release stages of continuous delivery. The entire development team will know within minutes of check-in whether you've created bad code, as the continuous integration service automatically builds and tests your code changes for any errors.
Continuous delivery and continuous deployment follow continuous integration in the DevOps cycle.
Continuous delivery (CD) picks up where continuous integration ends, automating the delivery of applications to selected infrastructure environments. CD focuses on delivering any validated changes to the code base—updates, bug fixes, even new features—to users as quickly and safely as possible. It ensures the automation of pushing code changes to different environments, such as development, testing and production.
In continuous deployment, the code changes to an application are released automatically into the production environment. This automation is driven by a series of predefined tests. Once new updates pass those tests, the system pushes the updates directly to the software's users.
Commonly cited benefit of continuous integration include:
Agile is a software development practice that improves how software development teams organize themselves, adapt to changes in requirements and release software. Because continuous integration (link resides outside IBM) and agile development share many of the same features (e.g., testing automation), it can be useful to talk about continuous integration and agile at the same time. Agile organizes development into smaller groups of work or sprints. When applied in DevOps, these combined practices help to ensure software quality and project flexibility.
Continuous integration requires you to integrate work frequently, often many times per day. You verify integration by an automated build that detects integration errors as early as possible. The build should include run tests as part of verification. Extending the rapid testing to run time tests in an automated testing environment leads naturally towards continuous delivery.
Agile (link resides outside IBM) is also iterative and adapts to change so it can scale and evolve solutions over time. In the context of continuous integration, agile software development is about delivering software iterations based on how you prioritize the value of the features as you continuously integrate.
Popular open source continuous integration tools include:
Conducting continuous integration with open source tools offers many benefits, including the following:
Open source continuous integration tools to consider for your software development workflow include Jenkins, Go, Buildbot and Travis CI, which you can read about in the next section.
A continuous integration server is a software tool that centralizes all your continuous integration operations and provides a reliable, stable platform for you to build your projects. You can configure and adjust CI servers to build various projects for different platforms. A continuous integration server easily models and visualizes complex workflows (enabling continuous delivery) and provides an intuitive interface for building continuous delivery pipelines. A continuous integration server offers the ability to do the following:
The following hypothetical use case illustrates how two software developers can use continuous integration to improve their DevOps process.
The two developers must communicate with each other on which features work and how. This small team needs regular updates and must be able to integrate and test their code as a whole. Scheduling code check-in and testing take up a lot of development time. An automatic system for continuous integration is needed.
Negotiating when these combinations and tests would happen would eat up a lot of developer time. They would have to agree on the following:
Continuous integration platforms have default answers to these questions and most allow configuration and setup.
Typically, CI platforms like Jenkins begin integration tests on check-in. When new code is checked in, the CI system will run a set of tests, which can include unit tests and regression tests, and then determine if the code was successfully integrated.
Either way, most CI systems log the integration attempts, success rate and other metrics.
The importance of testing
Continuous testing begins when you produce a continuous integration build and a package (also known as an installable entity or packaged entity). It stops when that packaged entity goes into production. Every step from end to end involves a testing suite.
At a minimum, when you only have one test stage, 30 percent of continuous integration involves testing. In reality, continuous integration activities are comprised of 50 percent to 70 percent testing. It used to be that you had to complete testing manually. Now you can use automated tests—the key to successful continuous integration.
As part of automating testing for continuous integration, test-driven development iteratively builds code and tests one use case at a time to ensure test coverage, improve code quality and set the groundwork for continuous delivery. Automated testing tells you whether new code failed one or more of the tests developed across all functional areas of the application. A best practice requires developers to run all or a subset of tests in their local environments, which ensures that developers only commit source code to version control after the new code changes pass their tests. Experience shows that effective regression testing can help avoid unwelcome surprises later.
The continuous integration pipeline
A continuous integration pipeline automates stages of a project's pipeline—such as builds, tests and deployments—in a repeatable way, with minimal human intervention. An automated continuous integration pipeline is essential to streamline the development, testing and deployment of your applications by enabling controls, checkpoints and speed.
Continuous integration best practices
The continuous integration process is a critical component of DevOps, which helps you unify your development and operations teams into a shared repository for coding, testing, deploying and supporting software. The following are some CI best practices that can help you succeed:
Configure and run software builds easier with the IBM UrbanCode Build tool, an enterprise-scale build-management solution that uses a template-driven system.
DevOps speeds delivery of higher quality software by combining and automating the work of software development and IT operations teams.
Continuous delivery automates delivery of applications to testing and production environments.
A practical guide to the continuous integration/continuous delivery (CI/CD) pipeline..
Are you ready for DevOps? Delivering software and services at the speed the market demands requires teams to iterate and experiment rapidly, and to deploy new versions frequently, driven by feedback and data. The most successful cloud development teams adopt modern DevOps culture and practices, embrace cloud-native architectures, and assemble toolchains from best-in-class tools to unleash their productivity.