Use the Jenkins - Merge Requests Webhook to Link a Jenkins Job to a Merge Request

You can use the Jenkins - Merge Requests webhook to link a Jenkins job to a merge request. When a commit is pushed to the review branch of the merge request, the webhook sends a notification to Jenkins and triggers a build of the linked job. When the build completes, it sends a notification back to VB Studio. The linked build will approve or reject the merge request, based on the status of the build.

The Jenkins Merge Request is an outgoing as well as an incoming webhook. The Jenkins job and the webhook must use the merge request's Git repository with parameters to define the branch. The Notification plugin must also be installed on Jenkins.

You need to specify the Jenkins security settings to allow the webhook to connect to Jenkins.

If ... Do this:
Jenkins allows an anonymous user to trigger a build on Jenkins
  1. Create an authentication token in the Jenkins job.
  2. Use the authentication token to configure the webhook to connect to the Jenkins job.
Jenkins allows only authenticated users to trigger a build
  1. Get an authenticated user's API Access token.
  2. Create an authentication token in the Jenkins job.
  3. Use the API Access and the authentication token to configure the webhook to connect to the Jenkins job.

Anonymous access on Jenkins is disabled or lacks read permissions and you want to trigger the job without an authenticated user's credentials

or

Jenkins uses a build token root to trigger builds

  1. Install the Build Authorization Token Root Plugin on Jenkins if it has not already been installed.
  2. Create an authentication token in the Jenkins job.
  3. Configure the webhook to connect to Jenkins job using the authentication token.
Security is completely disabled on Jenkins Configure the webhook to connect to Jenkins job. No Jenkins configuration is required.