Integration with GitLab Pipelines

Introducing, an improved way of integrating DeepSource with GitLab for continuous quality and shift left.

  • By Eshaan Bansal
  • ·
  • Product
  • Releases
Last updated May 24, 2022

We're constantly working on ways to improve how DeepSource integrates with your team's software development workflow. Over time, as version control providers evolve, we evolve with them to ensure your team gets the best experience when using DeepSource. Today, we are excited to announce support for GitLab Pipelines Commit Statuses.

This change is now live for all users of DeepSource Cloud and DeepSource Enterprise.

Background

Previously, for each new commit to a merge-request, an analysis on DeepSource would start automatically. The result and summary of these analyses were posted as comments on the GitLab merge-request page. Historically, this was the only way for external services to integrate with GitLab's merge-request workflow.

Analysis result as a comment on GitLab merge request page

This was not ideal, and made the merge-requests quite noisy. In our integrations with other version control providers, we already post updates to their platforms directly. Such a tight integration works better with other external services, allows for automated workflows, and thus makes for an overall superior developer experience.

What's new

After the release of GitLab's new Commits API, we can now post the status of a DeepSource run as a build status for the specific commit. This is identified by GitLab as a pipeline consisting of multiple jobs where each job is a particular Analyzer or Transformer run on DeepSource.

Analysis results as pipelines on GitLab merge requests

This improves the experience of using our GitLab integration in several ways:

  1. You no longer need to scroll and scan for the latest comment to see the analysis result. Just see the commit’s pipeline status.

Commit status on GitLab merge requests

  1. Analysis results will be visible as pipelines also for commits in the default branch that are not part of any merge request.

Commit status on GitLab default branch

  1. You can implement merge checks to ensure that DeepSource analysis passes before a merge-request is merged to the default branch. This enables you to put quality gates in place, so no bad code makes it to the code base.

Configure repository settings on GitLab

Switching to GitLab's Commit Statuses on DeepSource

To prevent unwanted behavior changes, all existing repositories will remain on the old "Comments" mode, while all new repositories will default to the new "Pipelines/Commit Status API" mode. You can choose between these two integration modes on per repository basis by toggling the "Integration mode" option in your repository’s settings page on DeepSource.

Repository settings page on DeepSource

We're excited to see how this change improves the experience for all our users who use DeepSource with their GitLab projects. If you have any questions or feedback, please let us know on our discussion forum.

Ship clean and secure code.