It's a common pattern to write Jenkins pipeline code like this:
def call(body) {
def config = [:]
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
}
I'm not sure how to word this simply, but this closure get implicitly imported and can be called by the file name of the .groovy file it lives in.
I call it like:
MyClosure { myarg = 'sdfsdf' }
I not entirely sure what this is doing. It's doing call(body) and then assigning body as the delegate. so that means the closure I pass it is the delegate, but isn't that just the owner? Wah? me confused.