Skip to content

Commit 50464ae

Browse files
Set "ref" in PR build status for Bitbucket Server
1 parent 737df70 commit 50464ae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketBuildStatusNotifications.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,20 @@ private static void sendNotifications(BitbucketSCMSource source, Run<?, ?> build
220220
* causes the build status disappear from the web page.
221221
* The only working value is null. If commit is used for two different
222222
* pull requests than you will get status doubled in both PRs
223+
*
224+
* For Bitbucket Server, refName should be "refs/heads/" + the name
225+
* of the source branch of the pull request, and the build status
226+
* should be posted to the repository that contains that branch.
227+
* If refName is null, then Bitbucket Server does not show the
228+
* build status in the list of pull requests, but still shows it
229+
* on the web page of the individual pull request.
223230
*/
224-
refName = null; // "refs/pull-requests/" + head.getBranchName();
225231
bitbucket = source.buildBitbucketClient(head);
232+
if (BitbucketApiUtils.isCloud(bitbucket)) {
233+
refName = null; // "refs/pull-requests/" + head.getBranchName();
234+
} else {
235+
refName = "refs/heads/" + head.getBranchName();
236+
}
226237
} else {
227238
listener.getLogger().println("[Bitbucket] Notifying commit build result");
228239
SCMHead head = rev.getHead();

0 commit comments

Comments
 (0)