Search code examples
gitjenkinspluginssonarqube

Disable "Accept Merge Request" button based on GitLab CI status and/or SonarQube results


I am using GitLab, Jenkins and SonarQube. All tools are with Free licences.

Currently we are having a need to implement more strict control over Git(Labs) Merge Request functionality based on "external" tools / plugins.

I am now trying to figure out how to implement the behaviour that would do the following:

  • listen to Jenkins Job build result
  • while GitLab has no result from Jenkisn Job, button "Accept Merge Request" is disabled.
  • once the result is recieved and it is Positive ( Thumbs Up icon ), button gets enabled.

Solution

  • This is being enabled by GitLab version 8.13.8-ee via UI, found in Project settings.

    See https://git.dev.eon.com/help/user/project/merge_requests/merge_when_build_succeeds#only-allow-merge-requests-to-be-merged-if-the-build-succeeds for more information.