Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins - load global pipeline library from filesystem instead of SCM?

I can't find anything in the docs on how to do this - anybody have any ideas?

like image 280
user797963 Avatar asked Jul 18 '17 23:07

user797963


2 Answers

It seems it is currently not possible. But you can easily init a local git repository and use it as SCM without any remote hostings.
To init a git repo use the following commands in the root directory of your shared library (for example C:\Users\Jenkins\pipeline-shared-library-test):

git init
git add .
git commit -m "init"

Then in Manage Jenkins->Configure System->Global Pipeline Libraries you can point Project Repository to you local repo using a file URI file:///c:/Users/Jenkins/pipeline-shared-library-test
This approach works fine for me. shared library form local git repo

like image 177
Vitalii Vitrenko Avatar answered Oct 01 '22 05:10

Vitalii Vitrenko


You can use File System SCM plugin to load your library from file system. Once you have installed this plugin, use "Legacy SCM" in your library configuration to set a path and choose "master" as default version. Can not use Load implicitly, so explicit configuration should be done in the pipeline.

As a reference, I read this approach in this slides https://www.slideshare.net/roidelapluie/jenkins-shared-libraries-workshop.

like image 42
Jordi Rodriguez Avatar answered Oct 01 '22 05:10

Jordi Rodriguez