Help Center/ CodeArts Pipeline/ Best Practices/ Configuring a Pipeline Gate for a Code Repository Merge Request
Updated on 2025-08-13 GMT+08:00

Configuring a Pipeline Gate for a Code Repository Merge Request

Overview

You can set an automated pipeline gate for merge requests in code repositories. By doing so, every merge request that triggers a pipeline will go through code checks, builds, or tests in the pipeline. Only code that has passed strict code review can be merged into the main branch. This mechanism ensures code stability and reliability, and effectively reduces production environment issues caused by code defects. Overall, this solution improves code quality and CI/CD efficiency.

Preparations

Process

  1. Log in to the Huawei Cloud console.
  2. Click in the upper left corner of the page and choose Developer Services > CodeArts Pipeline from the service list.
  3. Click Access Service.
  4. Click Create Pipeline and configure pipeline information as shown in Table 1.

    Table 1 Parameters

    Parameter

    Example Value

    Description

    Name

    Pipeline-Test

    Pipeline name.

    Project

    Project_Test

    Project that a pipeline belongs to.

    Pipeline Source

    Repo

    Pipeline source associated with the pipeline.

    Repository

    Repo_Test

    Code repository associated with the pipeline.

    Default Branch

    release-1.0.0

    Default branch of the repository.

  5. After configuring the basic information, click Next. On the displayed Select Template page, select Blank Template and click OK.
  6. Go to the Task Orchestration page. Two stages (Pipeline Source and Stage_1) are generated by default. You can add code check or build jobs as needed.

  7. Click the Execution Plan tab and configure Repo trigger events. Select Merge request, set events, filter branches, and filter paths. For details, see Configuring Event Triggers.

  8. Access the Repo_Test repository created in Preparations, choose Settings > Policy Settings > Merge Requests. In the Branch Policies area, click Create Branch Policy, select or enter a branch, select Enable pipeline gate, and click OK.

  9. Click the Merge Requests tab. On the displayed page, create a merge request in Repo_Test to trigger the pipeline. The pipeline running status will be displayed in the Merge Conditions area.