From 6eab3e957eedbc9e166023ae0e8bc24ccf5b69ca Mon Sep 17 00:00:00 2001 From: Aric Gardner Date: Tue, 25 Aug 2020 14:28:47 -0400 Subject: [PATCH] The openstack-cron job email report. The openstack-cron job should report to LF staff when it fails Upgrade notes: Will require all projects to add: failure-notification: "releng+PROJECTCODE@linuxfoundation.org" failure-notification-prefix: "[releng]" to jjb/defaults.yaml Issue-ID: IT-20409 Signed-off-by: Aric Gardner Change-Id: I0f4f9ad5f6e810898b9815d7ff66784557e2fc71 --- .jjb-test/defaults.yaml | 2 ++ docs/jjb/lf-macros.rst | 7 +++++++ jjb/lf-ci-jobs.yaml | 3 +++ jjb/lf-macros.yaml | 21 +++++++++++++++++++++ ...bal-jjb-email-notification-24186fedba802540.yaml | 15 +++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 releasenotes/notes/global-jjb-email-notification-24186fedba802540.yaml diff --git a/.jjb-test/defaults.yaml b/.jjb-test/defaults.yaml index f7d88947..34027eb9 100644 --- a/.jjb-test/defaults.yaml +++ b/.jjb-test/defaults.yaml @@ -27,3 +27,5 @@ project: releng/ciman stream: latest build-node: build-vm + failure-notification: "fake@example.org" + failure-notification-prefix: "[releng]" diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 3d1b39e8..4280cb80 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -530,3 +530,10 @@ lf-infra-wrappers-windows Provides lf-infra recommended wrappers for use in every job-template targetting Windows systems. + + +global-jjb-email-notification +----------------------------- + +Provides a publisher macro that ties into the lf-openstack-cron job +to alert admins if this job fails. diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index a7d2ceda..39ebc8f2 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -1412,6 +1412,9 @@ publishers: - lf-infra-publish + - global-jjb-email-notification: + email-recipients: "{failure-notification}" + email-prefix: "{failure-notification-prefix}" - job-template: name: "{project-name}-openstack-cron" diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 87267603..511e51d7 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -700,6 +700,27 @@ - "**/*.jenkins-trigger" fail-build: false +- publisher: + name: global-jjb-email-notification + publishers: + - email-ext: + recipients: "{email-recipients}" + reply-to: "" + content-type: default + subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!" + body: | + $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS: + + Please refer to the logs server URL for console logs when possible + and use the Jenkins Build URL as a last resort. + + Jenkins Build URL: + $BUILD_URL + unstable: true + fixed: true + send-to: + - recipients + ####### # SCM # ####### diff --git a/releasenotes/notes/global-jjb-email-notification-24186fedba802540.yaml b/releasenotes/notes/global-jjb-email-notification-24186fedba802540.yaml new file mode 100644 index 00000000..d04c7726 --- /dev/null +++ b/releasenotes/notes/global-jjb-email-notification-24186fedba802540.yaml @@ -0,0 +1,15 @@ +--- +prelude: > + Provides method to notify administrators if important jobs are failing. +features: + - | + Allows customization of email address and email prefix. + failure-notification-prefix + failure-notification +upgrade: + - | + Updating to this version of JJB will _require_ updating + jjb/defaults.yaml in the same patchset. + The following will need to be defined: + failure-notification: "foo@bar.org" + failure-notification-prefix: "[Some Prefix]" -- 2.16.6