You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by rl...@apache.org on 2023/04/28 12:54:25 UTC

[comdev-site] branch send-email-on-build-failure created (now 0e1b61a)

This is an automated email from the ASF dual-hosted git repository.

rlenferink pushed a change to branch send-email-on-build-failure
in repository https://gitbox.apache.org/repos/asf/comdev-site.git


      at 0e1b61a  Add a failure and fixed section to the Jenkinsfile for sending notificatins

This branch includes the following new commits:

     new 0e1b61a  Add a failure and fixed section to the Jenkinsfile for sending notificatins

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[comdev-site] 01/01: Add a failure and fixed section to the Jenkinsfile for sending notificatins

Posted by rl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rlenferink pushed a commit to branch send-email-on-build-failure
in repository https://gitbox.apache.org/repos/asf/comdev-site.git

commit 0e1b61a7580e1274489cd5d8445aca4f1f959d2e
Author: Roy Lenferink <le...@gmail.com>
AuthorDate: Fri Apr 28 14:54:03 2023 +0200

    Add a failure and fixed section to the Jenkinsfile for sending notificatins
---
 Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/Jenkinsfile b/Jenkinsfile
index 9f52128..4624782 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -168,5 +168,43 @@ pipeline {
             }
             deleteDir() /* clean up our workspace */
         }
+
+        // If the build failed, send an email to the list.
+        failure {
+            script {
+                if (env.BRANCH_NAME == 'main') {
+                    emailext(
+                        to: "dev@community.apache.org",
+                        recipientProviders: [[$class: 'DevelopersRecipientProvider']],
+                        from: "Jenkins <je...@ci-builds.apache.org>",
+                        subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
+                        body: """
+There is a build failure in ${env.JOB_NAME}.
+
+Build: ${env.BUILD_URL}
+"""
+                    )
+                }
+            }
+        }
+
+        // Send an email, if the last build was not successful and this one is.
+        fixed {
+            script {
+                if (env.BRANCH_NAME == 'main') {
+                    emailext(
+                        to: "dev@community.apache.org",
+                        recipientProviders: [[$class: 'DevelopersRecipientProvider']],
+                        from: 'Jenkins <je...@ci-builds.apache.org>',
+                        subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
+                        body: """
+The build for ${env.JOB_NAME} completed successfully and is back to normal.
+
+Build: ${env.BUILD_URL}
+"""
+                    )
+                }
+            }
+        }
     }
 }