'How to get the BRANCH_NAME to be passed into another job using Jenkinsfile

So I have a svn repo like this "svn://xyz-repo/svn/ccsmp/branches/features/cre-777",

and I want to pass this part "branches/features/cre-777" as BRANCH_NAME to another job.

Now Inside Jenkinsfile I am doing this -

def BRANCH_NAME = sh(script: " svn info | grep -Po 'Relative URL: \\^/\\K.*' ", returnStdout: true , trim: true)

This code "svn info | grep -Po 'Relative URL: \^/\K.*'" is not working because I am using an old jenkins version that has old/missing plug-ins.

Is there any other way to fetch the part from the URL that I want. Please help any suggestions would be highly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source