Link a Build Job to a Merge Request

Linking build jobs to a merge request enables you to monitor them from the merge request and trigger them when a commit is pushed to the review branch. Depending on the build’s status, reviewers can determine whether the merge request is ready to be merged with the target branch.

  1. Configure the job to accept merge request parameters.
  2. Open the merge request.
  3. Click the Linked Builds tab.
    The tab displays linked jobs, if any.
  4. In Search and Link Build Jobs, enter the job name and select it from the list.

    Note:

    When you create a job and select the For Merge Request option in the Create Job dialog, VB Studio automatically adds the Merge Request parameters and parameterized Git settings to the job configuration. These jobs appear in the list of jobs that can be linked to a merge request.

    To convert an existing job (a job that wasn't created using the For Merge Request option) into a Merge Request job, add the Merge Request parameters (MERGE_REQ_ID, GIT_REPO_BRANCH, GIT_REPO_URL) manually in the Parameters tab and parameterize the Git setting (with ${GIT_REPO_URL}) in the Git tab. Only after you do that, will the job will appear in the list of jobs that can be linked to a merge request.

  5. Click Save OK.

After a job is linked to a merge request, a build automatically runs when the review branch is updated with a commit.

When a build of a linked job runs, a comment is automatically added to the Conversation tab. If the build succeeds, it will auto-approve the merge request and add itself to the Approve section of the Review Status list. If the build fails, it will auto-reject the merge request and add itself to the Reject section of the Review Status list.