From e17801268de2e6faddfa9edecf0d9d56670d38f1 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 18 Feb 2022 07:12:19 +0200 Subject: [PATCH] MPL-96 Fix detection of library directory location (#95) Co-authored-by: Ruslan Yemelianov --- src/com/griddynamics/devops/mpl/Helper.groovy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/griddynamics/devops/mpl/Helper.groovy b/src/com/griddynamics/devops/mpl/Helper.groovy index 176fe045..3bf92440 100644 --- a/src/com/griddynamics/devops/mpl/Helper.groovy +++ b/src/com/griddynamics/devops/mpl/Helper.groovy @@ -87,8 +87,16 @@ abstract class Helper { def modules = [] def libs = new FilePath(executable.getRootDir()).child('libs') action.getLibraries().each { lib -> + def libDir + // TODO: backward compatibility SECURITY-2422, should be removed in future to use only "getDirectoryName() method" + // https://github.com/jenkinsci/workflow-cps-global-lib-plugin/commit/ace0de3c2d691662021ea10306eeb407da6b6365 + try { + libDir = lib.getDirectoryName() + } catch(NoSuchMethodError) { + libDir = lib.name + } MPLManager.instance.getModulesLoadPaths().each { modulesPath -> - def libPath = Paths.get(lib.name, 'resources', modulesPath, path).toString() + def libPath = Paths.get(libDir, 'resources', modulesPath, path).toString() def f = libs.child(libPath) if( f.exists() ) modules += [[libPath, f.readToString()]] }