-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
There is no way to write reusable chunks of Declarative Pipeline configuration.
Jenkinsfile has no facility for this, and
shared libraries support only scripted groovy (classes, steps, globals).
- is duplicated by
-
JENKINS-43429 stage when result is not respected when used from a library
-
- Closed
-
-
JENKINS-43455 Loading Declarative Pipeline inside 'steps' causes NPE
-
- Closed
-
-
JENKINS-44053 When section not evaluated
-
- Closed
-
-
JENKINS-45306 Sharing of declarative pipeline between similar projects
-
- Closed
-
-
JENKINS-42327 Add support for defining declarative pipeline templates in shared libraries
-
- Closed
-
-
JENKINS-43794 Ability to import/inherit pipeline stages
-
- Closed
-
-
JENKINS-42220 Add ability to import stages from a library
-
- Closed
-
- is related to
-
JENKINS-46476 Environment and Options blocks do not take effect from within groovy shared variable
-
- Open
-
-
JENKINS-45306 Sharing of declarative pipeline between similar projects
-
- Closed
-
- relates to
-
JENKINS-46547 Add support for defining Declarative pipelines in shared libraries
-
- Closed
-
Hi abayer, thanks for looking at this. Not sure if this helps provide context or not, but here's the use case that I'm dealing with.
Basically, declarative pipeline is great if you have to define a single (or few) build. In my case, I'm basically trying to set some standards that will apply across dozens or maybe hundreds of builds where I don't want to copy/paste 100+ lines of a declarative Jenkinsfile across projects.
I'm looking for stuff like this:
def config = [foo: 'foo", bar: 'bar'] buildNpmApp(config)
or
def config = [foo: 'foo", bar: 'bar'] buildSpringBootAppWithDocker(config)
Now, I know that I can do that using global pipeline libraries now, but I'd like to be able to use the clean, simplified nature of declarative in the global pipeline library. The notation is hard to follow for folks when using the more raw nature of the global pipeline libs (even when using var)
So, I'm sort of thinking that in my case, even if I could stuff a whole pipeline {...} inside of a shared lib, I'd be in good shape. Being able to mix and match steps and stages would be even better, but a whole pipeline would probably suffice.
Tim