-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
I'm trying to use the lock() option in an options block of a stage. I want the lock resource to be dynamic (depending on an environment variable).
For example:
environment { BRANCH_TO_USE = get_branch_to_use() } stages { stage('Lock build'){ options { lock(resource: "lock-${env.BRANCH_TO_USE}", quantity: 1) } stages { ...
But the resulting string is always "lock-null". I tried it without "env." but to no avail.
I would expect this to work especially since the environment variable is available in the coming stages with no problem.
Is there a way to support this or a possible workaround?
- duplicates
-
JENKINS-55587 Env variables not available in pipeline options sections, outside of stages
-
- Open
-
mariusmeyer did you come up with a solution for this?