-
Bug
-
Resolution: Fixed
-
Critical
-
None
Given the following declarative pipeline:
pipeline { stages { stage('Example stage') { when { expression { false } } options { lock resource: 'example resource' } steps { // ... } } } }
Even though 'example stage' is skipped due to the when conditional, a lockable resource 'example resource' is created (if it doesn't already exist) and a lock is acquired on it. I think this is counter intuitive. The consequence is also really bad – a skipped stage might actually make the whole build hang (possibly for a long time) because it needs to acquire a lock on a busy resource (typically used by another build).
- causes
-
JENKINS-61007 pipeline-model-definition is using findbugs without providing / depending on it
-
- Resolved
-
- is duplicated by
-
JENKINS-55485 Declarative pipeline, lock() in stage options is executed before when clause
-
- Closed
-
- links to
[JENKINS-51865] Stage locks are created for skipped stages in declarative pipeline
Description |
Original:
Given the following declarative pipeline: {noformat} pipeline { stages { stage('Example stage') { when { expression { false } } options { lock resource: 'example resource' } steps { // ... } } } } {noformat} Even though 'example stage' is skipped due to the when conditional, a lockable resource 'example resource' is created (if it doesn't already exist) and a lock is acquired on it. I think this is counter intuitive -- one would not expect the lock to be acquired when the stage is skipped. |
New:
Given the following declarative pipeline: {noformat} pipeline { stages { stage('Example stage') { when { expression { false } } options { lock resource: 'example resource' } steps { // ... } } } } {noformat} Even though 'example stage' is skipped due to the when conditional, a lockable resource 'example resource' is created (if it doesn't already exist) and a lock is acquired on it. I think this is counter intuitive. The consequence is also really bad – a skipped stage might actually make the whole build hang (possibly for a long time) because it needs to acquire a lock on a busy resource (typically used by another build). |
Component/s | New: pipeline-model-definition-plugin [ 21706 ] | |
Component/s | Original: lockable-resources-plugin [ 18222 ] | |
Assignee | New: Andrew Bayer [ abayer ] |
Attachment | New: Screenshot 2019-01-30 at 10.56.27.png [ 45838 ] |
Link |
New:
This issue is duplicated by |
Remote Link | New: This issue links to "PR 356 (Web Link)" [ 23837 ] |
Assignee | Original: Andrew Bayer [ abayer ] | New: Falko Modler [ famod ] |
Released As | New: https://github.com/jenkinsci/pipeline-model-definition-plugin/releases/tag/pipeline-model-definition-1.4.0 | |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Open [ 1 ] | New: Fixed but Unreleased [ 10203 ] |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Resolved [ 5 ] |
Link |
New:
This issue causes |