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 <[email protected]>
wrote:

> 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 pipeline before committing them to master branch potentially breaking
> builds.
>
> I get the following warning in the console output:
>
> WorkflowScript: @Library value ‘jenkins-pipeline@$env.BRANCH_NAME’ was not a 
> constant; did you mean to use the ‘library’ step instead?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/ca65b535-4225-41ef-9497-ac69a10098c2%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/ca65b535-4225-41ef-9497-ac69a10098c2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9KA3CF_jfGc95b_gscAceu9172WwZL_TcS9vnOyDfj-ww%40mail.gmail.com.

Reply via email to