Skip to main content
Create a quality gate with Bitbucket

Learn how to create a quality gate with Bitbucket that will only let merge code that passes Clayton's reviews.

Gabriele Gallo Stampino avatar
Written by Gabriele Gallo Stampino
Updated over 7 months ago

What is a quality gate?

A quality gate is the best way to enforce a quality policy in your organization. Setting up a quality gate allows you to prevent any code that doesn't pass code reviews from being merged into certain branches.

Key Benefits

  • Enforce code quality consistency across the entire project

  • Ensure that newly committed code doesn't introduce problems

  • Ensure issues are addressed before being merged

Before to start

Before proceeding with creating a quality gate in your VCS for your repo, you must enable the Clayton Automation for your project.

Connection User

Bitbucket requires approvals for the Pull Requests (PRs) from a different user than the author of the PRs. The quality gate with Clayton will fully work only if a dedicated connection user for Clayton is configured for your project.
Please have a look at our Help Article to learn how to set up a new connection user.

Enable Automation

Make sure to activate the Clayton Automation to monitor your code and start using webhooks to publish status updates for the PR and branch reviews on your VCS.
Please have a look at the dedicated Help Article to learn how to enable automation.

Steps

In your repository settings in Bitbucket, go under Settings  > Branch permissions.

  1. Go to Bitbucket > Repository > Repository settings > Branch restrictions

  2. Select the branch you would like to create the gate for

  3. Click on Edit > Merge checks

Suggested setup

  1. Configure the desired number of approvals
    Example: 2 developers and 1 architect.

  2. Configure the minimum number of successful builds to be the number of active Calyton policies.
    Example: if a project has 6 Clayton policies active, configure 6 builds.

  3. Select the Reset requested changes when the source branch is modified flag to ensure that new developments are validated.

  4. Select the Prevent a merge with unresolved merge checks flag to make sure not to bypass checks and gate developments effectively.

  5. Click on Save

Read more


Did this answer your question?