I have the following problem. I have a Jenkinsfile where I list the shared libraries I want to import in the following format:
@Library('my-shared-library1')
@Library('my-shared-library2@1.0')
@Library('my-shared-library3@my-branch-name')
I want to retrieve the name of the branches - in my case 1.0 and my-branch-name and store them in a separate variable. I tried to use the env.GIT_BRANCH
and env.BRANCH_NAME
methods for that, but they both return only the pull-request number of my pipeline (e.g., PR-316 or master) but not a specific name of my branch.
In other words, is there a way to check whether something follows the @ sign in the library name and return it?
Thank you very much in advance.