You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2018/12/10 13:48:43 UTC

[incubator-plc4x] branch develop updated: PLC4X-78 - Write operations seem to fail - Inserted a failure - Finetuned the Jenkinsfile to send nicer formatted emails and one email if the build is back to normal

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

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1712ddb  PLC4X-78 - Write operations seem to fail - Inserted a failure - Finetuned the Jenkinsfile to send nicer formatted emails and one email if the build is back to normal
1712ddb is described below

commit 1712ddb8e34ba8851919be3331df149bec19b676
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Dec 10 14:48:11 2018 +0100

    PLC4X-78 - Write operations seem to fail
    - Inserted a failure
    - Finetuned the Jenkinsfile to send nicer formatted emails and one email if the build is back to normal
---
 Jenkinsfile                                        | 21 ++++++++++++++++++---
 .../java/s7/connection/S7PlcConnectionIT.java      |  2 +-
 tools/jenkins/failure-email-template.html          | 22 ++++++++++++++++++++++
 tools/jenkins/success-email-template.html          | 22 ++++++++++++++++++++++
 4 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 54c6459..00c842d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -197,22 +197,37 @@ pipeline {
 
     // Send out notifications on unsuccessfull builds.
     post {
-         failure {
+        // If this build failed, send an email to the list.
+        failure {
             emailext (
                 subject: "[BUILD-FAILURE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
-                body: """<p>BUILD-FAILURE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]':</p><p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"</p>""",
+                body: ${FILE,path="tools/failure-email-template.html"},
                 to: "dev@plc4x.apache.org",
                 recipientProviders: [[$class: 'DevelopersRecipientProvider']]
             )
         }
+
+        // If this build didn't fail, but there were failling tests, send an email to the list.
         unstable {
             emailext (
                 subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
-                body: """<p>BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]':</p><p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"</p>""",
+                body: ${FILE,path="tools/failure-email-template.html"},
                 to: "dev@plc4x.apache.org",
                 recipientProviders: [[$class: 'DevelopersRecipientProvider']]
             )
         }
+
+        // Send an email, if the last build was not SUCCESSfull and this one is.
+        success {
+            if (currentBuild.previousBuild != null && currentBuild.previousBuild.result != 'SUCCESS') {
+                emailext (
+                    subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
+                    body: ${FILE,path="tools/success-email-template.html"},
+                    to: "dev@plc4x.apache.org",
+                    recipientProviders: [[$class: 'DevelopersRecipientProvider']]
+                }
+            }
+        }
     }
 
 }
\ No newline at end of file
diff --git a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionIT.java b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionIT.java
index 45b105b..405230b 100644
--- a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionIT.java
+++ b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionIT.java
@@ -127,7 +127,7 @@ public class S7PlcConnectionIT {
 
         SUT.close();
 
-        //fail("Intentionally failing this test in order to test the email notifications");
+        fail("Intentionally failing this test in order to test the email notifications");
     }
 
 }
diff --git a/tools/jenkins/failure-email-template.html b/tools/jenkins/failure-email-template.html
new file mode 100644
index 0000000..957ec98
--- /dev/null
+++ b/tools/jenkins/failure-email-template.html
@@ -0,0 +1,22 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<p>BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]':</p>
+
+<p>Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>"</p>
\ No newline at end of file
diff --git a/tools/jenkins/success-email-template.html b/tools/jenkins/success-email-template.html
new file mode 100644
index 0000000..cf04d5e
--- /dev/null
+++ b/tools/jenkins/success-email-template.html
@@ -0,0 +1,22 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+
+<p>BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]':</p>
+
+<p>Is back to normal.</p>
\ No newline at end of file