You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: bitbucket service pull request build status from different source
The commit 7ac886d switched to the newer repository commit build
status api. This introduced a regression in the case the PR source
repository is not the same as the target, for example a person fork.
In this case the bitbucket api created from the PR head will point to
the fork repo and may result in a 401 error if the credentials don't
have the necessary permissions.
```
ERROR: Could not send notifications
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error.
Status: HTTP/1.1 401
Response: {"errors":[{"context":null,"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.bitbucket.AuthorisationException"}]}
```
This change will force the bitbucket api instance to be the target repo
which is the appropriate target for the notification. The old api was
commit hash centric, not project centric, so the api client owner/repo
didn't matter.
This change also reverts changes introduced by jenkinsci#954 to the refName
parameter. Since notification is on the targget repo, the head ref
branch may not exist on the target and result in no status update.
No changes were made to the Bitbucket Cloud code path.
Copy file name to clipboardExpand all lines: src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/notifier/BitbucketBuildStatusNotifications.java
0 commit comments