Reputation: 3943
if I am running concurrent Jenkins jobs, eg,
TestPipeline
TestPipeline@2
TestPipeline@3
How do I get the value of @2, @3, etc? Is there an env variable, or do I have to back it out from the path? It isn't EXECUTOR_NUMBER
, which doesn't always match.
Upvotes: 0
Views: 427
Reputation: 553
As @ben5556 told you in the comment, you have to parse the WORKSPACE
environment variable.
For me, the best way to get the number (without using sh
) is:
"@${env.WORKSPACE.split('@').last()}"
You can remove the @
at the beginning of the string if you only want the number.
Upvotes: 1