-
Type:
Story
-
Resolution: Duplicate
-
Priority:
Major
-
Component/s: pipeline-model-definition-plugin, pipeline-stage-step-plugin
-
None
-
Environment:Jenkins ver. 2.60.1
There are multiple projects with similar pipelines.
I can reuse declarative pipeline right now by importing library with pipeline defined:
Jenkinsfile:
@Library('github.com/my/libs@master') _ common_jenkinsfile { // project parameters }
github.com/my/libs/common_jenkinsfile.groovy:
def call(body) {
def config = [:]
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
pipeline {
agent any
stages {
stage('This one should be skipped') {
when {
expression { false }
}
steps {
echo "this should be skipped, but it does not ("
}
}
}
}
}
The problems are:
- This is not officially supported, so can break with any next Jenkins release
- 'when' does not work in this case, so stages are never skipped
- duplicates
-
JENKINS-42224 Need ability to create reusable chunks of Declarative Pipeline
-
- Open
-
- is related to
-
JENKINS-42224 Need ability to create reusable chunks of Declarative Pipeline
-
- Open
-