-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins: 2.46.3
OS: CentOS 6.8
Java Version: 8
Plugins (selected):
cloudbees-bitbucket-branch-source: 2.2.7
git: 3.6.4
git-client: 2.6.0
branch-api: 2.0.15
credentials: 2.1.16
credentials-binding: 1.13
After upgrading the the cloudbees-bitbucket-branch-source plugin from 2.1.2 to 2.2.7, loading a pipeline shared library from a pull request no longer works
Before the upgrade, it was possible to access and test code in a PR by appending the following refspec to the global shared library configuration:
+refs/pull-requests/*/from:refs/remotes/origin/pr/*
(as suggested in this guide to fetching Bitbucket pull requests). Using this refspec would allow a developer's PR to be tested using a syntax such as:
@Library('pipeline-libs@pr/28') // '28' is the PR ID
Since updating the plugin to 2.2.7, this approach is no longer possible, so it is not possible to access a developer's shared library changes from Jenkins before merging the PR.
This is the output from Jenkins:
Loading library pipeline-libs@pr/28 Attempting to resolve pr/28 from remote references... > git --version # timeout=10 using GIT_SSH to set credentials Jenkins public key > git ls-remote -h -t ssh://git@stash.forgerock.org:7999/re/jenkins-pipeline-libs.git # timeout=10 Could not find pr/28 in remote references. Pulling heads to local for deep search... > git rev-parse --is-inside-work-tree # timeout=10 Setting origin to ssh://git@stash.forgerock.org:7999/re/jenkins-pipeline-libs.git > git config remote.origin.url ssh://git@stash.forgerock.org:7999/re/jenkins-pipeline-libs.git # timeout=10 Fetching origin... Fetching upstream changes from origin > git --version # timeout=10 using GIT_SSH to set credentials Jenkins public key > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* +refs/pull-requests/*/from:refs/remotes/origin/pr/* > git rev-parse pr/28^{commit} # timeout=10 > git branch -v --no-abbrev --contains 36750e665cd8155d02b73d339e41ee5cd374599a # timeout=10 Could not find a branch containing commit 36750e665cd8155d02b73d339e41ee5cd374599a ERROR: No version pr/28 found for library pipeline-libs [BFA] Scanning build for known causes... [BFA] No failure causes found [BFA] Done. 0s [Bitbucket] Notifying commit build result [Bitbucket] Build result notified org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: WorkflowScript: Loading libraries failed
It seems the commit I wish to test (36750e665cd8155d02b73d339e41ee5cd374599a) is correctly identified from the refspec, but no branch exists for this commit (since it is in a PR only) so the job is failing.
Similar issues exist have been resolved for the GitHub branch source plugin - JENKINS-45953 and JENKINS-45830