Re: Jenkins @Library load dynamic branch from variable

2020-01-16 Thread Chris Carpenter
Yes it's mostly to ease testing changes. Our pipelines are tied to kubernetes/openshift so there's a lot of interaction there that I need to make sure a whole pipeline still runs. Was hoping to dynamically update the right branch of the pipeline library so we don't accidentally commit a to

Re: Jenkins @Library load dynamic branch from variable

2020-01-16 Thread Jan Monterrubio
When testing library changes, I usually make a new folder and specify the branch I am testing there. I’ve never tried to do the dynamic environment variable. Is your end goal to integration test your library before merging it to master? We do something similar by standing up a local Jenkins and

Re: Jenkins @Library load dynamic branch from variable

2020-01-16 Thread Chris Carpenter
It seems with this you lose some functionality with code in the `src` directory. Using classes from the src/ directory is also possible, but trickier. > Whereas the @Library annotation prepares the “classpath” of the script > prior to compilation, by the time a library step is encountered the

Re: Jenkins @Library load dynamic branch from variable

2020-01-15 Thread Jan Monterrubio
https://jenkins.io/doc/book/pipeline/shared-libraries/ Check the loading dynamic libraries portion. It might do what you want. On Wed, Jan 15, 2020 at 15:12 Chris Carpenter wrote: > Is there a way to dynamically load the library from dynamic branch > variable like this: > >

Jenkins @Library load dynamic branch from variable

2020-01-15 Thread Chris Carpenter
Is there a way to dynamically load the library from dynamic branch variable like this: @Library("jenkins-pipeline@${env.BRANCH_NAME}") _ In a multi branch pipeline you have access to the current branch name in the environment variable `BRANCH_NAME`. I'd like to be able to test changes to my