Hi Kenneth, I am curious, have you found a satisfying answer yet? I am currently splitting up our build pipeline into reusable global methods and am asking myself the same questions.
I played around with the standardBuild example to implement a build skeleton for our build pipelines: https://github.com/jenkinsci/pipeline-examples/blob/master/global-library-examples/global-function/standardBuild.groovy But more and more I come to the conclusion, that I will avoid using the closure technique and just implement a global function with proper arguments. Maybe there should be some guidelines (and maybe a real world example) added to the best practises when to use which technique. Regards and a happy new year, Daniel Am Montag, 19. September 2016 14:30:46 UTC+2 schrieb Kenneth Baltrinic: > > Trying to get my head around what is the best way to implement some custom > pipeline DLS commands using global functions > <https://github.com/jenkinsci/workflow-cps-global-lib-plugin#defining-global-functions>. > > I am looking at the examples given under Defining a more structured DSL > <https://github.com/jenkinsci/workflow-cps-global-lib-plugin#define-more-structured-dsl>, > > which shows an example of accepting arguments via variable assignments > inside of a closure. Is this the preferred method? It seems most build in > commands (git, sh, etc) accept a Map of arguments. I am not a groovy > expert but am trying to understand why/when one approach is better than the > other? Any thoughts or illumination on this would be appreciated. > -- 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/34b8b98a-435d-4c2e-9513-013f7d276ec1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
