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 - 
I had opened this jira https://issues.jenkins-ci.org/browse/JENKINS-43576 
that showed Environment section (and other things) don't work unless the 
pipeline{} is at the root of the Jenkinsfile.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f9a84e6c-4aa6-464e-96f5-657209d463ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to