aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Rendina <mrendina@stsci.edu>2017-06-07 14:42:27 -0400
committerMatt Rendina <mrendina@stsci.edu>2017-06-07 14:42:27 -0400
commit277175ed0d5bedc87e18a41de8b2e44a5636d62e (patch)
treea6e13a9f19b2ece50ed51b4b1b7b9e2f594b0247
parentb884dca38379284c52ed6634ba9c2e70f31393dc (diff)
downloadbuild_control-277175ed0d5bedc87e18a41de8b2e44a5636d62e.tar.gz
Setup for build status propagation to dispatch job
-rw-r--r--jenkins/dispatch.groovy9
-rw-r--r--jenkins/package_builder.groovy14
2 files changed, 23 insertions, 0 deletions
diff --git a/jenkins/dispatch.groovy b/jenkins/dispatch.groovy
index f05d906..6d37274 100644
--- a/jenkins/dispatch.groovy
+++ b/jenkins/dispatch.groovy
@@ -15,6 +15,8 @@
this.utils_dir = "utils"
this.recipes_dir = "conda-recipes"
+this.build_status_file = "propagated_build_status"
+
// The conda installer script to use for various <OS><py_version> combinations.
this.conda_installers = ["Linux-py2.7":"Miniconda2-${CONDA_VERSION}-Linux-x86_64.sh",
"Linux-py3.5":"Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh",
@@ -195,6 +197,10 @@ node(LABEL) {
this.build_list = build_list_text.trim().tokenize()
println("Build list:")
println(build_list_text)
+
+ // Write build status file to facilitate build status propagation
+ // from child jobs.
+ sh "echo SUCCESS > ${this.build_status_file}"
}
stage("Build packages") {
@@ -210,6 +216,9 @@ node(LABEL) {
string(name: "channel_URL", value: this.manifest.channel_URL)],
propagate: false
}
+ // Set overall status to that propagated from individual jobs.
+ // This will be the most severe status encountered in all sub jobs.
+ currentBuild.result = readFile this.build_status_file
}
}
diff --git a/jenkins/package_builder.groovy b/jenkins/package_builder.groovy
index 37812ec..be868b0 100644
--- a/jenkins/package_builder.groovy
+++ b/jenkins/package_builder.groovy
@@ -1,3 +1,5 @@
+this.build_status_file = "${this.parent_workspace}/propagated_build_status"
+
node(this.label) {
dir(this.parent_workspace) {
@@ -28,6 +30,8 @@ node(this.label) {
"PYTHONPATH: ${env.PYTHONPATH}\n" +
"PYTHONUNBUFFERED: ${env.PYTHONUNBUFFERED}\n")
+ def build_status = readFile this.build_status_file
+
// In the directory common to all package build jobs,
// run conda build --dirty for this package to use any existing work
// directory or source trees already obtained.
@@ -63,6 +67,11 @@ node(this.label) {
returnStatus: true)
if (stat != 0) {
currentBuild.result = "FAILURE"
+ // Check if build status file already contains failure
+ // status. If not, write failure status to the file.
+ if (build_status != "FAILURE") {
+ sh "echo FAILURE > ${this.build_status_file}"
+ }
}
}
@@ -79,6 +88,11 @@ node(this.label) {
returnStatus: true)
if (stat != 0) {
currentBuild.result = "UNSTABLE"
+ // Check if build status file already contains unstable
+ // status. If not, write unstable status to the file.
+ if (build_status != "FAILURE") {
+ sh "echo FAILURE > ${this.build_status_file}"
+ }
}
}