I am working on a team that has a lot of projects with independent Jenkins declarative pipeline files. Most of those files duplicate a lot of the pipeline definition. We would benefit from share collections of step
and an entire stage
in a shared library. While the former appears to be possible with declarative pipelines the later does not.
The question of stage
definitions was covered in June 2018 here with the accepted answer being NO. A later answer recommended using script blocks to share stages ... coming up with a messy scripted/declarative pipeline. Moreover, the request on the Jenkins jira is still open and hasn't had any meaningful movement since April 2018.
So before I waste a bunch of time jamming a square peg in a round hole or ignoring a perfectly reasonable solution, is the best solution to just embrace scripted pipelines? That syntax would allow me to define usable chucks of the pipeline at any level. I could have one-liner pipelines for cases where a "cookie cutter" build is acceptable, or larger customized pipelines that reuse a few complete stages but perhaps deploy code in a different manner.