-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
Background:
I am currently involved with the development of a large pipeline library consisting of multiple pipelines and shared classes for repeatable tasks. This pipeline library has a large number of unit and integration tests and we run it against various quality tools. The configurations for those tools are quite large and we have centralised them into the library itself, i.e. the library code is used as part of the library pipelines themselves. Rather than duplicate the whole configuration into the Jenkinsfile for the slight difference the library pipeline itself requires I have been trying to load the librarys version of the configuration.
Request:
In order to better test pipeline library changes which use functionality from the same shared global library I would like to allow the loading of approved global libraries at a semi-dynamic or aligned version without being forced into using a sandboxed version or other methods such as disabling script security. In my use case, I want to dynamically check out the global library at the same version as my pull request/branch for the same library I am developing new features on.
If I load the library with the annotation i have to statically provide the version which is sometimes okay but not ideal:
@Library("My_Library@feature/improve-library") _
PipelineLibraryPipeline()
Currently, we dynamically load our library for testing the library like this:
lib = library("My_Library@${env.GIT_BRANCH}").some.level.of.package
this works okay while using enums and most basic features but when I need to do something more complex like access a builder class for a complicated piece of configuration or either a public static final constant on a library I get blocked by the sandbox script security.
I'm open to alterative ideas if someone has an easier way of achieving what i want, thanks.