Skip to content

Commit be4c5ee

Browse files
authored
Merge pull request #11592 from Joe-Downs/pr/jenkins-improvements
Improving Jenkins error-handling and build description
2 parents 068b7d4 + ce98e00 commit be4c5ee

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.ci/community-jenkins/Jenkinsfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ if (buildNumber > 1) {
3030
}
3131
milestone(buildNumber)
3232

33+
// Add build description linking back to PR. This is redundant to the "GitHub"
34+
// link on the Pull Request page, but the Build page does not have a direct link
35+
// back to the PR. The "Details" link at the bottom of the GitHub PR page brings
36+
// you to the Jenkins Build page, so we're adding the link back to the GitHub PR
37+
// page.
38+
currentBuild.description = "This is a build of <a href=\"${CHANGE_URL}\"}\">Open MPI PR #${CHANGE_ID}</a>"
39+
3340
check_stages = prepare_check_stages()
3441
println("Initialized Pipeline")
3542

@@ -79,7 +86,16 @@ def prepare_build(build_name, label, build_arg) {
7986
stage("${build_name}") {
8087
node(label) {
8188
checkout(changelog: false, poll: false, scm: scm)
82-
sh "/bin/bash -x .ci/community-jenkins/pr-builder.sh ${build_arg} ompi"
89+
// If pr-builder.sh fails, the sh step will throw an exception,
90+
// which we catch so that the job doesn't abort and continues on
91+
// to other steps - such as cleanup. Because we catch the
92+
// exception, we need to tell Jenkins the overall job has
93+
// failed.
94+
try {
95+
sh "/bin/bash -x .ci/community-jenkins/pr-builder.sh ${build_arg} ompi"
96+
} catch (Exception e) {
97+
currentBuild.result = "FAILURE"
98+
}
8399
cleanWs(notFailBuild: true)
84100
}
85101
}

0 commit comments

Comments
 (0)