wojtek1902
wojtek1902

Reputation: 601

Block merge on BitBucket until Jenkins task is completed

I'm looking for some way to block a possibility of making merge of pull requests on the BitBucket if some specified Jenkins task is currently running. Do you know if it is possible? I was looking for that in the Jenkins Git plugin and in the settings of BitBucket but with no success... Thank you in advance for any help!

Upvotes: 6

Views: 6538

Answers (2)

cantSleepNow
cantSleepNow

Reputation: 10170

In bitbucket go to the project and then the repository you want to enable this feature for, and under settings->pull request check the option

Requires a minimum of [n] successful builds

Upvotes: 4

Sam
Sam

Reputation: 2882

This can be done using the bitbucket build status api.

1) Enable require minimum 1 successful builds in bitbucket repo settings https://blog.bitbucket.org/2015/11/18/introducing-the-build-status-api-for-bitbucket-cloud/

Then either: Manually in jenkins pipeline fire the API calls to set the build status to in in progress, failed, success

Alternatively, using something like the https://wiki.jenkins.io/display/JENKINS/GitHub+Branch+Source+Plugin which will do this automatically for you (sending the statuses) plus a host of other things (like automatically discovering new repos with Jenkinsfiles)

Upvotes: 1

Related Questions