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

rcordier pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/james-site.git

commit b94945499cdbc37120729d2173e8e4eb754a6337
Author: Tellier Benoit <[email protected]>
AuthorDate: Fri Apr 2 18:19:12 2021 +0700

    [JAMES-3226] Automatically publish staging doc (#11)
    
    This enables building and publishing the antora documentation
    automatically when the build of the master branche of james-project is
    green.
    
    Co-authored-by: Jean Helou <[email protected]>
---
 Jenkinsfile | 74 +++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 52ea02c41..f7659e92f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -28,8 +28,12 @@ pipeline {
         label AGENT_LABEL
     }
 
+    triggers {
+        upstream(upstreamProjects: '../ApacheJames/master', threshold: 
hudson.model.Result.SUCCESS)
+    }
+
     environment {
-        CI=true
+        CI = true
     }
 
     tools {
@@ -88,17 +92,29 @@ pipeline {
         failure {
             echo "Failed "
             script {
-                emailext(
-                        subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
-                        body: """
-BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] 
[${env.BUILD_NUMBER}]':
-
-Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"
-""",
-                        to: "[email protected]",
-                        recipientProviders: [[$class: 
'DevelopersRecipientProvider']]
-                )
+                if (env.BRANCH_NAME == "live" || env.BRANCH_NAME == "staging") 
{
+                    emailext(
+                            subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
+                            body: """
+        BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] 
[${env.BUILD_NUMBER}]':
+
+        Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"
+        """,
+                            recipientProviders: [[$class: 
'DevelopersRecipientProvider']]
+                    )
+                } else {
+                    emailext(
+                            subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
+                            body: """
+        BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] 
[${env.BUILD_NUMBER}]':
+
+        Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"
+        """,
+                            recipientProviders: [[$class: 
'RequesterRecipientProvider']]
+                    )
+                }
             }
+
         }
 
         // If this build didn't fail, but there were failing tests, send an 
email to the list.
@@ -110,17 +126,31 @@ Check console output at "<a 
href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANC
         success {
             echo "Success "
             script {
-                if ((currentBuild.previousBuild != null) && 
(currentBuild.previousBuild.result != 'SUCCESS')) {
-                    emailext (
-                            subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
-                            body: """
-BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]':
-
-Is back to normal.
-""",
-                            to: "[email protected]",
-                            recipientProviders: [[$class: 
'DevelopersRecipientProvider']]
-                    )
+                if (env.BRANCH_NAME == "live" || env.BRANCH_NAME == "staging") 
{
+
+                    if ((currentBuild.previousBuild != null) && 
(currentBuild.previousBuild.result != 'SUCCESS')) {
+                        emailext(
+                                subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
+                                body: """
+    BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] 
[${env.BUILD_NUMBER}]':
+
+    Is back to normal.
+    """,
+                                recipientProviders: [[$class: 
'DevelopersRecipientProvider']]
+                        )
+                    }
+                } else {
+                    if ((currentBuild.previousBuild != null) && 
(currentBuild.previousBuild.result != 'SUCCESS')) {
+                        emailext(
+                                subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} 
[${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
+                                body: """
+    BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] 
[${env.BUILD_NUMBER}]':
+
+    Is back to normal.
+    """,
+                                recipientProviders: [[$class: 
'RequesterRecipientProvider']]
+                        )
+                    }
                 }
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to