Library Structure¶
Overview¶
Each directory within a Library Source is a different library that can be loaded via the Pipeline Configuration
The name of the directory is the library identifier used within the Pipeline Configuration libraries{} block when loading the library.
| Path | Description |
|---|---|
steps/**/*.groovy |
groovy files under the steps directory will be loaded as steps where the basename of the file will be the name of the function made available in the pipeline |
resources/**/* |
any file under the resources directory will be accessible from within Library Steps via the resource() step |
src/**/* |
Classes contributed by the library that can be imported from within Pipeline Templates and steps |
library_config.groovy |
the library configuration file |
Example Library Structure¶
exampleLibraryName # (1)
├── steps # (2)
│ └── step1.groovy # (3)
│ └── step2.groovy
├── resources # (4)
│ ├── someResource.txt # (5)
│ └── nested
│ └── anotherResource.json # (6)
├── src # (7)
│ └── example
│ └── Utility.groovy # (8)
└── library_config.groovy # (9)
- This library would be loaded via the
exampleLibraryNameidentifier in thelibraries{}block - All steps contributed by the library goes in the
stepsdirectory - An example step. A
step1step would be added to the pipeline - All library resources go in the
resourcesdirectory - A root level resource. The contents could be fetched from
step1orstep2viaresource("someResource.txt") - A nested resource. The contents could be fetched from
step1orstep2viaresource("nested/anotherResource.json") - File paths within the
srcdirectory must be unique across libraries loaded and will be made available to the Class Loader for both steps and templates - A class file containing the
example.Utilityclass. - The library configuration file