wrong quantity when using lock/extra
girish1906 opened this issue · 1 comments
girish1906 commented
Describe your use-case which is not covered by existing documentation.
lock (extra:env.VSR_EXECUTION == 'true' ? [[label: 'SRPreCommitSanityTestBeds']] : [], quantity: 1, variable: 'VSR_SWITCH', resource: null)
when using lock/extra in the above situation where I'm locking based on env. variable, it locks/skips fine based on VSR_EXECUTION value, but quantity when condition satisfies it tried to acquire all resources with label SRPreCommitSanityTestBeds though I've specified 1.
Trying to acquire lock on [{Label: SRPreCommitSanityTestBeds}]
Found 4 available resource(s). Waiting for correct amount: 6.
[{Label: SRPreCommitSanityTestBeds}] is locked, waiting...
any help is appreciated.
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response
girish1906 commented
was able to achieve this by adding beforeOptions in when condition -
stage('run VSR_EXECUTION ') {
when {
beforeOptions true
expression { env.VSR_EXECUTION .toBoolean() } }
options {
lock(label: 'SRPreCommitSanityTestBeds', quantity: 1, variable: 'VSR_SWITCH', resource: null )
}
This way, the lock is skipped when the expression inside when loop is not satisfied.
you can close this if you feel like.