Load dynamic jenkins shared library from pull request

62 Views Asked by At

I am trying to load Jenkins shared library dynamically, I tried below

library identifier: 'custom-lib@pull/111/head', retriever: modernSCM( [$class: 'GitSCMSource', remote: '[email protected]:my-jenkins-utils.git', credentialsId: 'my-private-key'])

I tried few options like identifier: 'custom-lib@origin/pr/111/from' and dentifier: 'custom-lib@origin/pr/111/merge'

nothing is working, getting below error:

ERROR: Could not resolve pull/111/head

Please suggest if there is any other way

1

There are 1 best solutions below

0
Umesh Kumar On

I got this working by making slight change in the library identifier. Example given on the jenkins docs https://www.jenkins.io/doc/book/pipeline/shared-libraries/ have example of github as I am using Bitbucket i had to below change in the library identifier to make this working.

library identifier: 'custom-lib@pull-requests/111/from'