howto use library function for parameter list

344 views
Skip to first unread message

Thomas Markus

unread,
Feb 21, 2022, 9:22:01 AM2/21/22
to jenkins...@googlegroups.com
Hi,

I'm using the extended choice parameter plugin for a selection list made
by a groovy script.

How can I use a library function for this? Currently I have to copy my
scipt. I'm to dumb to find that answer myself :(

best regards
Thomas

OpenPGP_0x9794716335E9B5AF.asc
OpenPGP_signature

christop...@googlemail.com

unread,
Feb 21, 2022, 9:32:26 AM2/21/22
to Jenkins Users
This is what my pipeline looks like:
@Library('MyBuild') _

myBuild( module: MyModule', platform: 'win32vc19' )

Maybe its similar for the extended choice-plugin?

Christoph Vogtländer

unread,
Feb 21, 2022, 11:17:14 AM2/21/22
to jenkins...@googlegroups.com

Hi,


Am Montag, 21. Februar 2022, 15:28:09 CET schrieb Thomas Markus:

> How can I use a library function for this? Currently I have to copy my

> scipt.


You mean using a function from a custom pipeline library for a scripted value of the extended choice? I don't think this is possible. As the script for the extended choice parameter is executed _before_ the job has started, the library will not be available.

When using a library inside a run (@Library decorator or library() function), Jenkins will check out a working copy of the library into a special @lib folder. The groovy code is then loaded from there and can be used inside the pipeline. But, this happens only when the build is actually started.


See also https://stackoverflow.com/questions/53636109/how-can-i-include-a-shared-library-in-the-jenkins-script-console
--

Christoph

Reply all
Reply to author
Forward
0 new messages