Continuous integration 没有这种DSL方法';步骤';在台阶间找到的
每当CI使用groovy脚本失败时,我都会尝试将其发送到一个空闲通道。但是,当我尝试实现这个内部故障块时,我得到了这个错误 执行故障后置条件时出错: java.lang.NoSuchMethodError:在步骤[archive、bat、build、catchError、checkout、deleteDir、dir、dockerFingerprintFrom、dockerFingerprintRun、echo、envVarsForTool、error、fileExists、getContext、git、input、isUnix、junit、libraryResource、load、lock、mail、milestone、node、parallel]中未找到此类DSL方法“步骤” 然而,我能够应用相同的代码在stages块下的其他管道中发送Slack通知。当应用于post块时,看起来好像有问题Continuous integration 没有这种DSL方法';步骤';在台阶间找到的,continuous-integration,jenkins-pipeline,jenkins-groovy,Continuous Integration,Jenkins Pipeline,Jenkins Groovy,每当CI使用groovy脚本失败时,我都会尝试将其发送到一个空闲通道。但是,当我尝试实现这个内部故障块时,我得到了这个错误 执行故障后置条件时出错: java.lang.NoSuchMethodError:在步骤[archive、bat、build、catchError、checkout、deleteDir、dir、dockerFingerprintFrom、dockerFingerprintRun、echo、envVarsForTool、error、fileExists、getContext、
post{
总是{
cleanWs()
}
失败{
台阶{
slackSend baseUrl:'https://hooks.slack.com/services/',
通道:“#构建失败”,
iconEmoji:“,
消息:“CI因-#${env.BRANCH_NAME}-${currentBuild.currentResult}()”而失败,
teamDomain:“Differentitau”,
tokenCredentialId:“松弛令牌生成失败”,
用户名:“”
}
}
}
这应该可以:
post {
always {
cleanWs()
}
failure {
slackSend baseUrl: 'https://hooks.slack.com/services/',
channel: '#build-failures',
iconEmoji: '',
message: "CI failing for - #${env.BRANCH_NAME} - ${currentBuild.currentResult} (<${env.BUILD_URL}|Open>)",
teamDomain: 'differentau',
tokenCredentialId: 'slack-token-build-failures',
username: ''
}
}
post{
总是{
cleanWs()
}
失败{
slackSend baseUrl:'https://hooks.slack.com/services/',
通道:“#构建失败”,
iconEmoji:“,
消息:“CI因-#${env.BRANCH_NAME}-${currentBuild.currentResult}()”而失败,
teamDomain:“Differentitau”,
tokenCredentialId:“松弛令牌生成失败”,
用户名:“”
}
}
概括来说,这里的主要方法是失败
子句不需要(也不能包含)一个步骤
子句