I have several Java projects that have some essentially identical stages--e.g., the Build stage increments the version number, does some sanity checks, and performs a Maven build with unit tests. All of the differences between these projects can be isolated in the environment or build parameters (e.g. PROJECT_NAME="foo").
It would be helpful to be able to inherit or compose pipelines in such a way that I could do something like this (just as a conceptual example):
The general logic being something like:
- walk up the tree of useTemplate
- collect all the libraries and environment blocks from the top down, overriding with lower-level definitions
- execute the stages defined in the lowest-level file, using the inherited stage definition if no closure is supplied
- perhaps support the ability to require that a previous stage has completed (e.g., in the template, require 'Acceptance Tests' before 'Production Deploy'