subfolders under vars for shared repo- or however this is support to be organized?

20 views
Skip to first unread message

red 888

unread,
Dec 7, 2017, 10:30:52 AM12/7/17
to Jenkins Users
Im using the src folder and writing groovy classes. These are wrappers around java api. Its nice because I can use package name-spacing, but whats not nice is in order to use them in a declarative pipeline I have to do this in my steps:

script { mySexyAssClass.aMethod('sdsdfsdf','sdfsdfds') }

I want to use these like pipeline steps. Now I _can_ do that with global functions I put in vars, but unlike src I don't think vars can have subfolders so that folder done get real sloppy. Is there a way to have subfolders under vars?

I was thinking about having a separate shared repo just for reusable custom "steps". It would have classes in src _and_ corresponding functions in vars that use the classes. I my pipelines I could call the vars like a regular steps. Is this a common way of organizing this?

Brantone

unread,
Jul 22, 2018, 2:16:42 AM7/22/18
to Jenkins Users
This is one of the gray areas that seems confusing about difference between src and vars ... per https://www.slideshare.net/BrentLaster/2017-jenkins-world/36  . “Unless you need to create one class with a bunch of static methods it is easier to use global vars in the /vars directory instead of classes in the /src directory”.
Sadly there's no way to do subfolders in vars , but I feel the pain about how it would get real sloppy :(
Reply all
Reply to author
Forward
0 new messages