In my Jenkins project, I have a library (i.e. a .groovy file in the /vars directory).
I need to load a shared library from a different github repo. In fact I need it from a specific branch of that repo, and it is a private repo that requires user authentication.
How can I do this?
You can use global jenkins configuration for libraries
https://www.jenkins.io/doc/book/pipeline/shared-libraries/#using-libraries
and define 2 libraries there. For private repo you will need to have credentials for github.
in Jenkinsfile you can use
and in libA/vars/somepipeline.groovy
you need to write
this line will load libB and you will be able to use code from library B in library A