I am trying to build a function that accepts parameters to override defaults but I keep getting "null".
I have written a simple function:
// vars/Run.groovy
def test(String type, String parallel = 'yes') {
println(type)
println(parallel)
}
My pipeline looks like this:
node('master') {
Run.test('unit')
Run.test('unit', parallel = 'no')
}
The result I get is:
unit
yes
unit
null
What am I missing?
You just have to pass the value. This will override your default value.
Run.test('unit', 'no')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With