First my understanding of folder-level shared libraries: It's a groovy script I can place anywhere in the repository where I want it to use (i.e. where my Jenkinsfile will be).
If this is wrong please let me know.
My question:
How can I include this library. For global libraries I can use @Library($libraryName)
to import libraries I registered with a name as global library. But for folder-level libraries there is no name specified. How do I import them? Do I really have to specify the git repo like demonstrated in this answer?
In Jenkins, go to Manage Jenkins → Configure System. Under Global Pipeline Libraries, add a library with the following settings: Name: pipeline-library-demo. Default version: Specify a Git reference (branch or commit SHA), e.g. master.
A shared library or shared object is a file that is intended to be shared by multiple programs. Symbols used by a program are loaded from shared libraries into memory at load time or runtime.
Folder-level shared libraries work similar to global shared libraries.
They also need a dedicated repository featuring the known layout (vars
, src
folders). And you need to load the using @Library
if you choose not to load implicitely.
Differences are:
Just open the settings of a Jenkins folder and you'll find the options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With