paint-brush
Why Your Team Needs to Add CM to Its CI/CD Pipelineby@devinterrupted
579 reads
579 reads

Why Your Team Needs to Add CM to Its CI/CD Pipeline

by Dev InterruptedJanuary 26th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Continuous merge (CM) improves the time it takes for a PR to be reviewed and merged. This article discusses how devs can expedite their code reviews and improve the speed to merge by introducing CM into the continuous integration and continuous deployment (CI/CD) pipeline. CI/CD pipeline shortens the iterations of new feature adoption, testing, product development, and deployment. It increases deployment speed by identifying bugs in the early stages of production so that they can be fixed faster. Small changes that don’t require in-depth reviews are auto-approved to the time to merge.
featured image - Why Your Team Needs to Add CM to Its CI/CD Pipeline
Dev Interrupted HackerNoon profile picture

A pull request (PR) is a standard methodology many teams use to submit and review code contributions from other developers. However, the pick-up and review process may delay the PR cycle time. Continuous merge (CM) improves the time it takes for a PR to be reviewed and merged.


CM is a rules-based approach that improves code- merge efficiency. It increases awareness of the PRs and provides crucial context, such as providing an estimated time of reviews. CM automates where possible and only uses humans when needed.


CM classifies each pull request based on change size, complexity, and type. This approach automates the merge path based on the unique merge conditions of each PR. Extra attention is given to those PRs that need it, while the PRs involving small changes are expedited to improve the efficiency and speed of merging.


This article discusses how devs can expedite their code reviews and improve the speed to merge by introducing CM into the continuous integration and continuous deployment (CI/CD) pipeline.


CI/CD Pipelines Run Better with Continuous Merge

The CI/CD pipeline shortens the iterations of new feature adoption, testing, product development, and deployment. It increases deployment speed by identifying bugs in the early stages of production so that they can be fixed faster. This is a two-part process:


  • CI is an automated process for checking new code changes for possible errors before merging into a central repository for testing.
  • CD deploys these code changes into a staging environment to ascertain their readiness for use in a production environment.


CI/CD Speedbumps

While CI/CD helps deliver new features to customers more quickly, several setbacks can delay this process.


Without delays from the reviewers or developers, PR reviews usually take a few hours. However, delays can cause these reviews to take days, weeks, or, even, months. A reviewer may be reluctant to take on PRs with too many lines of code due to the number of changes involved. Or they may prioritize other tasks and consider the PR review a distraction.


This can also slow the merge process and decrease CI/CD speed. Furthermore, if the delay affects a PR merge intended to fix bugs or introduce features, the slowdown manifests in the CI/CD pipeline.


A reviewer might respond slowly and request significant PR changes. Then, the developer may take a while to execute the necessary changes, delaying the merge further. A quick response to a code request review can, consequently, improve developer response times. This positive feedback cycle improves overall pipeline efficiency.


Pull Requests Examined

PRs push and merge all code changes, regardless of complexity. As a result, a change to fix a typo undergoes the same process as one that significantly alters several files.


Within this paradigm, any changes to the codebase receive equal treatment. In reality, the risk and size of changes differ. A simple PR may take days to receive “looks good to me” (LGTM) feedback or approval without the reviewer requesting code changes. Treating all PRs the same delays the merging of simple PRs that carry less risk.


Therefore, it’s essential to examine each PR and group it by its review requirements. PRs should be assessed based on risk and size, enabling low-risk items to receive instant approval.


Continuous Merge Pull Requests

CM streamlines the PR review process by automating whenever possible. It sorts reviews based on factors such as risk and content type. Depending on the code change, CM can determine what PRs or parts of the review process to automate.


Code reformatting, non-functional changes like tests and docs, or changes involving sensitive or deprecated APIs can be automated. PRs involving small changes that don’t require in-depth reviews are auto-approved to speed the time to merge. Small changes include image or text corrections that have passed all tests. Other minor changes — such as code format changes — can be approved and merged automatically.


Some reviewers are experts on a subject or familiar with similar PRs. In those cases, CM assigns them a particular PR to approve or merge simple changes that pass all checks. For PRs with many lines of code, CM allows you to assign more than one reviewer to hasten the approval process.

Instead of assigning a PR with missing tests, CM automatically marks such PRs that do not have test changes. PRs opened without tests are marked with a missing test label that’s removed automatically when the tests are added and committed. Additions to tests are also approved automatically. Consequently, any test cases added to the repo are checked. The PR is also approved automatically.

Benefits of Continuous Merge

With CM, developers can push code into production quickly while maintaining quality. This keeps the entire development process in motion constantly. Merge problems between branches are detected early and resolved to avoid delays.


CM also reduces bottlenecks by decreasing the number of people involved in each stage of the development and deployment process. This is achieved by classifying PRs according to different factors and assigning them to their perfect match.


Review automation allows PR labeling instead of manually assigning tags. This reduces time awaiting reviews and reviewing. Automation speeds the process of assigning reviewers.

CM reduces the waiting time for reviews by automating minor changes.

The Future of CI/CD

If code is stuck in the PR, the CI/CD pipeline may not meet its purpose of delivering quality code faster. CM helps achieve this goal by reducing the time required by your teams during the PR review and merging process. It’s just as crucial for organizations to compete in the future as CI/CD is now.


CM is the missing step in CI/CD

PRs are a common way of getting code changes reviewed and merged into a project’s repository. However, waiting long periods before PRs are merged is time-consuming and tedious. The PR pick-up time and review process contribute significantly to this problem.

Extending your CI/CD to include CM is an excellent way to improve the PR cycle time. CM takes a rule-based approach to merging code from a developer into a team’s repository. The code change review is guided by the risk, size, and importance of the change. CM is an excellent method to improve the CI/CD pipeline and, ultimately, the overall software development process.


Check out gitStream to add continuous merging to your development lifecycle.

Want to cut code-review time by up to 40%? Add estimated review time to pull requests automatically!

gitStream is the free dev tool from LinearB that eliminates the No. 1 bottleneck in your team’s workflow: pull requests and code reviews. After reviewing the work of 2,000 dev teams, LinearB’s engineers and data scientists found that pickup times and code review were lasting 4 to 5 days longer than they should be.


The good news is that they found these delays could be eliminated largely by adding estimated review time to pull requests!

Learn more about how gitStream is making coding better HERE.