Send email on publish-imagebuilder job failures
Change-Id: Ib8b84db5ed9a762f66ab7f10a0e22100b68dc5d9
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 819cfdf..e6940a7 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -38,6 +38,9 @@
cord-repo-manifest: manifest.git
cordqa-manifest-repo: qa-manifest.git
+ # default email address to send job failure messages
+ failure-email-address: 'cord-dev@opencord.org'
+
# regexp for gerrit triggers
# list of supported branches, for branch-regexp
supported-branches-regexp: '^(master|cord-6.0|cord-5.0|cord-4.1|cord-4.0)$'
diff --git a/jjb/imagebuilder.yaml b/jjb/imagebuilder.yaml
index f9f185d..d26d7f8 100644
--- a/jjb/imagebuilder.yaml
+++ b/jjb/imagebuilder.yaml
@@ -61,6 +61,10 @@
default: false
description: 'Force remove obsolete tags/images (same as "docker rmi --force")'
+ - string:
+ name: failureEmail
+ default: '{failure-email-address}, $GERRIT_PATCHSET_UPLOADER_EMAIL'
+ description: 'On job failure, send an email to these addresses'
project-type: pipeline
concurrent: false
diff --git a/jjb/pipeline/imagebuilder.groovy b/jjb/pipeline/imagebuilder.groovy
index deee937..a8636ea 100644
--- a/jjb/pipeline/imagebuilder.groovy
+++ b/jjb/pipeline/imagebuilder.groovy
@@ -75,5 +75,10 @@
archiveArtifacts artifacts: 'ib_actions.yml, ib_graph.dot, ib_logs/*', fingerprint: true
deleteDir()
}
+ failure {
+ emailext (
+ to: "${params.failureEmail}"
+ )
+ }
}
}