Solutions Delivery Platform

Accessing Library Resources

Steps can fetch static content from library resources defined within the library’s resources directory using the resources(String path) method.

For example, given a library:

exampleLibraryName
├── steps
│   └── step1.groovy
│   └── step2.groovy
├── resources
│   ├── someResource.txt
│   └── nested
│       └── anotherResource.json
└── library_config.groovy

Both step1 and step2 can fetch the contents of someResource.txt and nested/anotherResource.json using the resource method:

String someResource = resource("someResource.txt")
String anotherResource = resource("nested/anotherResource.json")

It’s important to note that:

  1. The path parameter passed to the resource method must be a relative path within the resources directory

  2. Only steps within a library can access the library’s resources (no cross-library resource fetching)

  3. The resource() method is only available within library steps and cannot be invoked from the pipeline template