pipeline : extend "node" ?

34 views
Skip to first unread message

Jonathan Hodgson

unread,
Jul 4, 2016, 5:49:38 AM7/4/16
to Jenkins Users
Hi,

I'm still very new to groovy, so please forgive me if the answer to this seems obvious.

In my pipeline project, there are things I want to do at the start of every node, so they would look something like


node
{
    do_common_stuff
    build_project
}


node
{
    do_common_stuff
    test_project
}



Rather than adding "do_common_stuff" to every node, is it possible to extend node so that I simply write

myNode {
    build_project
}


myNode
{
   test_project
}

    
and the do_common_stuff is executed before the content in the {} brackets?

Daniel Beck

unread,
Jul 4, 2016, 9:40:02 AM7/4/16
to jenkins...@googlegroups.com
This should get you started:
https://github.com/jenkinsci/workflow-cps-global-lib-plugin#pipeline-global-library
> --
> 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 jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/65448277-507f-44b7-bf8f-e95feb38eed2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Baptiste Mathus

unread,
Jul 4, 2016, 2:06:02 PM7/4/16
to jenkins...@googlegroups.com

Jonathan Hodgson

unread,
Jul 4, 2016, 8:53:30 PM7/4/16
to Jenkins Users, m...@batmat.net
Thanks guys, looks like exactly what I was looking for.

Reply all
Reply to author
Forward
0 new messages