Continuous Integration

Continuous Integration (CI) is the practice of routinely integrating code changes into the main branch of a repository, and testing the changes, as early and often as possible. Ideally, developers will integrate their code daily, if not multiple times a day.

Martin Fowler, Chief Scientist at ThoughtWorks, has stated that,

Continuous Integration doesn't get rid of bugs, but it does make them dramatically easier to find and remove.

Discussion

  • Why do we need Continuous Integration?

    In the past, developers on a team might work in isolation for an extended period of time and only merge their changes to the master branch once their work was completed. This made merging code changes difficult and time consuming, and also resulted in bugs accumulating for a long time without correction. These factors made it harder to deliver updates to customers quickly.

    With CI, each code change can potentially trigger a build-and-test process. Testing becomes an essential part of the build process. Bugs, if any, are highlighted early before they get a chance to grow or become hard to trace. Essentially, CI breaks down the development process into smaller pieces while also employing a repeatable process of build and test.

  • What are the benefits of Continuous Integration?

    Among the many benefits of CI are the following:

    • Shorter integration cycles
    • Better visibility of what others are doing leading to greater communication
    • Issues are caught and resolved early
    • Better use of time for development rather than debugging
    • Early knowledge that your code works along with others' changes
    • Ultimately, enabling the team to release software faster
  • How does Continuous Integration work?
    How CI works. Source: AWS 2018.
    How CI works. Source: AWS 2018.

    With continuous integration, developers frequently commit to a shared repository using a version control system such as Git. Prior to each commit, developers may choose to run local unit tests on their code as an extra verification layer before integrating. A continuous integration service automatically builds and runs unit tests on the new code changes to immediately surface any errors.

    Continuous integration refers to the build and unit testing stages of the software release process. Every revision that is committed triggers an automated build and test.

  • What are some CI tools and to choose among them?
    Comparing some CI tools. Source: Putano 2018.
    Comparing some CI tools. Source: Putano 2018.

    There are many solutions out there. Some of them include Codeship, TravisCI, SemaphoreCI, CircleCI, Jenkins, Bamboo, and Teamcity.

    Some factors to consider when selecting a tool include price (commercial or free), features, ease of use, integration (with other tools and frameworks), support (commercial or community) and more.

  • What are the challenges to Continuous Integration?

    To improve and perfect your CI, you need to overcome 3 major challenges:

    • No Standalone Fresh Checkout: The single biggest hurdle to a smooth CI build is ensuring that your application's tests can be run from a fresh code checkout (e.g. a git clone). This means that all of your app's dependencies are either included in the checkout, or they're specified and can be pulled in by a script in the checkout.
    • Unreliable Tests: Now that your app sets up with a single command, you've built a foundation for effective CI. The next challenge is to ensure that your test results are repeatable and reliable. Intermittent or "expected" failures that persist for too long are pernicious. Once the habit of treating failures as intermittent takes hold, legitimate errors often get ignored.
    • Obscure Build Results: Once you've produced a reliable test suite, the next challenge is to get results quickly, take appropriate action on them, and distribute information to the people who matter.
  • How are Continuous Integration, Continuous Delivery, and Continuous Deployment practices related to one another?
    The CI pipeline leading to CD. Source: Pittet 2018.
    The CI pipeline leading to CD. Source: Pittet 2018.

    Continuous integration leads to both continuous delivery and continuous deployment. Continuous deployment is like continuous delivery, except that releases happen automatically.

    More specifically, continuous integration requires automated testing to ensure that nothing is broken when new commits are made. Continuous delivery takes this to the next step by automating the release process so that your customers get regular fixes and upgrades.

    Continuous delivery still requires manual intervention to initiate the final deployment to production. Continuous deployment automates this last step too. There's no "Release Day" as such. Customers see a steady stream of improvements and this enables early feedback. Since releases are small, they're less risky and easier to fix. Jeff Humble, author of the book Continuous Delivery, says this about Continuous Deployment,

    Essentially, it is the practice of releasing every good build to users.

Milestones

1991

Grady Booch first proposes the term Continuous Integration (CI). In 1994, he uses the term in his book Object-Oriented Analysis and Design with Applications.

1997

Kent Beck and Ron Jeffries invent Extreme Programming (XP) while on the Chrysler Comprehensive Compensation System project. Beck publishes about continuous integration in 1998. Extreme Programming embraces the practice of CI.

2001

CruiseControl, one of the first open-source CI tools, is released.

References

  1. AWS. 2018. "How Does CI Works." Accessed 2018-10-17.
  2. Dan, Radigan. 2018. "Continuous integration, explained." Atlassian. Accessed 2018-10-17.
  3. Ianakiara, Dio. 2017. "The Importance of Continuous Integration in Software Development." Blog, Getty/IO, on Medium, September 25. Accessed 2020-07-23.
  4. Moorthi, Jay. 2012. "Challenges to continuous integration." Blog, Engine Yard, November 06. Accessed 2018-10-17.
  5. Pittet, Sten. 2018. "Continuous integration vs. continuous delivery vs. continuous deployment." Atlassian. Accessed 2019-01-14.
  6. Putano, Ben. 2018. "CI/CD Tools Throwdown: Jenkins vs. TeamCity vs. Bamboo." Stackify, February 03. Accessed 2018-10-17.
  7. ThoughtWorks. 2018. "Continuous integration." ThoughtWorks. Accessed 2018-10-17.
  8. Wikipedia. 2018. "Continuous integration." Wikipedia, October 01. Accessed 2018-10-17.

Further Reading

  1. Ellingwood, Justin. 2017. "An Introduction to Continuous Integration, Delivery, and Deployment." Digital Ocean, May 10. Accessed 2018-10-17.
  2. Fowler, Martin. 2006. "Continuous Integration." May 01. Accessed 2018-10-17.
  3. Stackify. 2017. "Top Continuous Integration Tools: 51 Tools to Streamline Your Development Process, Boost Quality, and Enhance Accuracy." Stackify, March 26. Accessed 2018-10-17.

Article Stats

Author-wise Stats for Article Edits

Author
No. of Edits
No. of Chats
DevCoins
2
0
628
2
2
285
1
0
211
1
1
19
814
Words
2
Likes
6593
Hits

Cite As

Devopedia. 2022. "Continuous Integration." Version 6, February 15. Accessed 2023-11-12. https://devopedia.org/continuous-integration
Contributed by
4 authors


Last updated on
2022-02-15 11:52:08

Improve this article

Article Warnings

  • Readability score of this article is below 50 (49.1). Use shorter sentences. Use simpler words.