Existing docs about writing Shared Libraries are mostly cover an old 'Scripted Pipeline'.
I have a shared library which perfectly works when pipeline is defined in a 'scripted' manner. However, it doesn't work when I use new 'Declarative' pipeline syntax.
Here's the "variable" code which leads to StackOverflowException on Jenkins. Can't figure out why.
def steps = new buildSteps()
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = steps
In the scripted pipeline this variable encloses methods of my build. All steps are implemented in buildSteps class, and every method is symply a 'bat $script'
Here's Declarative pipeline fragment
clean() // main method
Call to this library causes StackOverflowException on Jenkins.
If you switch back to old syntax, it works.
So, here's the request: Please improve Shared Libraries documentation and tell us how to write Shared Libraries for Declarative Syntax.
My sources are attached.