Points taken; I'm not surprised by your response. As I have no intention to write a plug-in for this, I'll wrap this up and think about presenting it on the user's list. (Where I already had two posts with no responses still).
My case is a bit exceptional in that I'm in complete control of all configuration of all Jenkins clusters at my company, which are configured using ansible and configuration as code, so I've got the Jenkins version and plug-in versions all locked in so there should be no surprises if the name Mangler class changed in a subsequent release. Importing and using the name Mangler class worked just fine, however it turned out to be completely unnecessary since I can just get the build directory (to construct the path to the artifacts on the controller) from the project/job object. So my shared library function is even simpler now and safer because it doesn't need to use any core or plug in classes. Most importantly, I've now got a robust and highly performant workaround to the old issue of very sluggish copying of artifacts. I'm getting about a 12-15x performance boost here. (We have several large artifacts) Thanks for your time.. On Tuesday, March 2, 2021 at 11:38:17 PM UTC-8 [email protected] wrote: > > > Le mer. 3 mars 2021 à 06:44, Tim Black <[email protected]> a écrit : > >> Think I found it: NameMangler.apply() >> <https://github.com/jenkinsci/branch-api-plugin/blob/f2bd7ec715057feb047754f5427f209bbf1b3248/src/main/java/jenkins/branch/NameMangler.java#L55>. >> >> Would it be possible/advised to import the NameMangler class in my Shared >> Library vars/scpArtifacts.groovy (assuming my Jenkins instance has >> branch-api plugin installed, which it does.) Something like this: >> >> ``` >> import jenkins.branch.NameMangler >> def mangled_branch_name = NameMangler.apply(branch_name) >> ``` >> >> I'll try this out in the morning, just curious if anyone can confirm >> whether this looks feasible or I'm way off track. Thanks. >> > > Using core java classes from Jenkins pipeline shared library is generally > strongly discouraged. > This could break from one day to another without notice. > What you're working on looks like it should rather be done in a full-blown > Jenkins plugin. > (If not, this discussion should be on the users mailing list) > > >> >> On Tuesday, March 2, 2021 at 8:03:57 PM UTC-8 Jesse Glick wrote: >> >>> The principal class to look at is `MultiBranchProject`. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" 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-dev/40b68498-b2ba-4e02-9c23-1eb76c04709an%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/40b68498-b2ba-4e02-9c23-1eb76c04709an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/0acb6136-73c4-46ba-a587-0554e899bf2dn%40googlegroups.com.
