jenkinsci / jenkinsci/workflow-cps-plugin
[JENKINS-49513] pipeline finally not reporting errors
- Dominant language
- Java
- Stars
- 186
- Forks
- 213
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 8
Description
Finally in a pipeline does not report critical errors, leading to mysterious failures.
E.g: this following pipeline excerpt does not construct the dependency-check-report.html file for archiving, and no error is logged. However, the build silently fails as a result.
try {
stage('Build and test') {
sh 'sbt -no-colors rebuild doc swaggerJson manifest'
}
} finally {
stage('Archive coverage report') {
archiveArtifacts "target/scala-2.12/scoverage-report/**"
publishHTML(target: [reportName: "Code coverage report", reportDir: "target/scala-2.12/scoverage-report", reportFiles: "index.html"])
}
stage('Archive vulnerability report') {
archiveArtifacts "target/scala-2.12/dependency-check-report.html"
publishHTML(target: [reportName: "Vulnerabilty report", reportDir: "target/scala-2.12", reportFiles: "dependency-check-report.html"])
}
}
---
Originally reported by
alt_jmellor, imported from: pipeline finally not reporting errors
Raw content of original issue
Finally in a pipeline does not report critical errors, leading to mysterious failures.
E.g: this following pipeline excerpt does not construct the dependency-check-report.html file for archiving, and no error is logged. However, the build silently fails as a result.
try {
stage('Build and test') {
sh 'sbt -no-colors rebuild doc swaggerJson manifest'
}
} finally {
stage('Archive coverage report') {
archiveArtifacts "target/scala-2.12/scoverage-report/**"
publishHTML(target: [reportName: "Code coverage report", reportDir: "target/scala-2.12/scoverage-report", reportFiles: "index.html"])
}stage('Archive vulnerability report') {
archiveArtifacts "target/scala-2.12/dependency-check-report.html"
publishHTML(target: [reportName: "Vulnerabilty report", reportDir: "target/scala-2.12", reportFiles: "dependency-check-report.html"])
}
}
- environment:
Jenkins 2.101 on Ubuntu-16.04.3, pipeline 2.5, pipeline API 2.24
Contributor guide
Research direction
Start by reproducing the provided Jenkins Pipeline excerpt in the workflow-cps-plugin context, focusing on the try/finally stages and the failing publishHTML or archiveArtifacts steps. Trace how errors from the finally block are handled; done means critical errors are reported and the build no longer fails silently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100