Sha*_*non 5 jenkins jenkins-pipeline
我遇到过有关此主题的较旧问题。即
但是,到目前为止,我希望 Jenkins Pipeline 能够内置此功能,而不是被黑客入侵。
在 Jenkins Pipeline 中运行post脚本时有什么方法可以找到构建失败吗?例如通过环境变量currentBuild等。
pipeline {
agent none
stages {
stage("Validate") {
parallel {
stage("Ubuntu") {
agent {
label "UBUNTU"
}
steps {
sh "cause failure"
}
}
}
}
}
post {
failure {
sendFailureMessage(`failure reason here`)
}
aborted {
sendFailureMessage(`failure reason here`)
}
unstable {
sendFailureMessage(`failure reason here`)
}
}
}
Run Code Online (Sandbox Code Playgroud)
为了繁荣,我最终创建了一个脚本来从 test-results.xml 文件中读取测试失败。这并不理想——我的意思是方便。但我找不到可行的内置方法。遗憾的是,詹金斯已经解析了该文件,并且应该在某处提供结果。
| 归档时间: |
|
| 查看次数: |
1666 次 |
| 最近记录: |