Declarative Shared Library - Adding stages from outside

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Declarative Shared Library - Adding stages from outside

Gavin Mogan
Hey Everyone,

I have a nice shared library pipeline that does a nice standard docker build -

This has worked great for the various pure docker projects I work on.

I'm looking to expand the library so I could do some before/after steps, which really just include running tests and calling junit(). I'm looking to do it in a nice declarative way though.

So far I came up with passing in a Closure, and calling it as needed inside scripts {} section

stage("Extra Steps") {
        steps {
          script {
            if (body) {

Buuut, that limits what I can do, I can't have more stages, just simple actions in one big blob. Its not unusable, but undesireable. I did find!searchin/jenkinsci-users/closure$20declarative|sort:date/jenkinsci-users/E-3O1rHWkdM/SELjMGWLAwAJ but it sorta goes down the same path.

Is there a way to merge in an external jenkinsfile? maybe a load or something? Ideally I'd like to just have body() or something being called instead of stage so I can just add whatever I want.

Anyone have any ideas/solutions?


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 [hidden email].
To view this discussion on the web visit