As a user, I would like to run different pipelines depending on what branch my commit happens on.
In Declarative Pipelines there is support for doing conditional stages, however, using this conditional logic has 2 issues:
- You cannot re-order stages based on the branches
- It makes the pipeline very hard to follow/understand
@AndrewBayer -
The reason I opened this is so that we can load branch specific logic and then based on the result of that we can invoke the declarative pipeline.
We wrote a shared library that allows teams to do this easily.
This allows the internals of each file to be declarative, easy to follow beginning to end and validateable.
Usage:
Using default branch logic
jules_startPipelines(this)
Specifying custom branch to pipeline file mapping
jules_startPipelines(this) {
pipelineFileMapping = ["develop": "develop-pipeline.groovy",
"master": "master-pipeline.groovy",
"PR-": "pull-request-pipeline.groovy",
"feature": "feature-pipeline.groovy",
"supercustom": "super-custom-pipeline.groovy"]
}
But since the environment section doesn't work it is fairly crippled.
What is your advice for achieving branch specific declarative pipelines?
Thanks,
Ken