use*_*263 4 groovy jenkins jenkins-pipeline
我正在尝试构建一个接受参数以覆盖默认值的函数,但我一直收到“null”。
我写了一个简单的函数:
// vars/Run.groovy
def test(String type, String parallel = 'yes') {
println(type)
println(parallel)
}
Run Code Online (Sandbox Code Playgroud)
我的管道如下所示:
node('master') {
Run.test('unit')
Run.test('unit', parallel = 'no')
}
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:
unit
yes
unit
null
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
你只需要传递值。这将覆盖您的默认值。
Run.test('unit', 'no')
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2601 次 |
最近记录: |