Activity

I'm trying to use the Jenkins Bitbucket Source branch plugin to manage the build for my branches and my PRs.
I've exactly the same issue.
Without the read permission, the plugin is not able to view the PR content:

Bruno Lavit
added a comment - 2017-02-03 13:21 Hi,
I'm trying to use the Jenkins Bitbucket Source branch plugin to manage the build for my branches and my PRs.
I've exactly the same issue.
Without the read permission, the plugin is not able to view the PR content:
Looking up SAN/forgerock-parent-bruno for branches
Checking branch master from SAN/forgerock-parent-bruno
Met criteria
No changes detected in master (still at 0c4cdd37be1f800f323e30f93890e19ce8bd6e52)
Checking branch 1.2.x from SAN/forgerock-parent-bruno
Met criteria
No changes detected in 1.2.x (still at fdf8b7e905414586a8eb50f83ce216f6bd5ec21c)
Looking up SAN/forgerock-parent-bruno for pull requests
Checking PR from ~B.LAVIT/forgerock-parent-bruno and branch bruno.pr.4
***Does not meet criteria***
Checking PR from ~B.LAVIT/forgerock-parent-bruno and branch bruno.pr.3
***Does not meet criteria***
If I give a read access to the account used to scan the repositories, it works:
Looking up SAN/forgerock-parent-bruno for branches
Checking branch master from SAN/forgerock-parent-bruno
Met criteria
No changes detected in master (still at 0c4cdd37be1f800f323e30f93890e19ce8bd6e52)
Checking branch 1.2.x from SAN/forgerock-parent-bruno
Met criteria
No changes detected in 1.2.x (still at fdf8b7e905414586a8eb50f83ce216f6bd5ec21c)
Looking up SAN/forgerock-parent-bruno for pull requests
Checking PR from ~B.LAVIT/forgerock-parent-bruno and branch bruno.pr.4
***Met criteria***
Scheduled build for branch: PR-5
Checking PR from ~B.LAVIT/forgerock-parent-bruno and branch bruno.pr.3
***Met criteria***
Scheduled build for branch: PR-4
I understand it's more a permissions problem on the Bitbucket side.
But if something is possible on the plugin side, it can help a lot.
Thanks

Alexandre Garnier
added a comment - 2017-02-23 14:58 A dirty hack in attachment: dirty-fix-JENKINS-40465.patch
It works only for BitbucketServer.
The idea is:
when checking PR, check against destination repository (the only one we are sure to have access to)
so check that 'Jenkinsfile' path exists on commit hash instead of PR branch (that may not exists in destination repository)
fetch the special refspec 'refs/pull-requests/<PR-NUMBER>/from' instead of the branch name (BitbucketServer specific, need to find a way to abstract this against the bitbucket type)
get PR tip from the PR lastCommit instead of looping against the destination branches to find the PR branch (that may not exists in destination repository) (don't know the impact on Bitbucket Cloud)

Kenneth Brooks
added a comment - 2017-04-17 04:11 I am facing the same issue. (Bitbucket Server 4.3.2)
Right now, for PRs coming from a fork, unless I add the scan credentials to the source repo (which is a personal/private forked repo), the scan doesn't find the Jenkinsfile.
The scan (and even the checkout) should get the code from the the commit hash on the destination repository.
I have all the code on the destination repo via that hash.
Alexandre Garnier does your patch work for both PRs coming from a forked repo as well as PRs coming from the original repo?