-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so:
pipeline { stages { stage('Build') { steps { reusableBuild() } } stage('Test') { steps { reusableTest() } } } }
I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages:
pipeline { stages { reusableBuild() reusableTest() stage 'Something individual' { steps { echo 'only for this project' } } } }
Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch
- duplicates
-
JENKINS-49135 Support for reusable sharing Declarative directives
-
- Open
-
I spent all day trying do this with Declarative Pipelines and finally had to give up. It was so easy to do things like this with Scripted Pipelines, but Declarative is the way going forward. It would be nice to have this with the shared pipeline library.