我有一个 Jenkins Pipeline JOB,我在其中声明了一些使用我自己在同一个 groovy 脚本中创建的外部函数的阶段。
errorList = ["badGatewayMsg", "closedByRemoteHostMsg", "connectionTimedOut"]
def boolean someFunction(name) {
String jobLog = jenkins.model.Jenkins.instance.getItemByFullName(name).lastBuild.log
for (error in errorList) {
if (jobLog.contains(error))
return true
}
return false
}
stage('stage1') {
if(someFunction('job1Name'))
// do Something
}
stage('stage2') {
if(someFunction('job2Name'))
// do Something
}
当我想开始这个管道构建时,我收到以下错误:
java.lang.NoSuchMethodError: No such DSL method 'someFunction' found among steps ....
谢谢你的帮助!