You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/01/15 12:27:24 UTC
[sling-tooling-jenkins] branch feature/SLING-7245 updated (68d72cb
-> 17859e6)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git.
from 68d72cb SLING-7245 - Validate pull requests using Jenkins
new 8140418 SLING-7245 - Validate pull requests using Jenkins
new 17859e6 SLING-7245 - Validate pull requests using Jenkins
The 2 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.
Summary of changes:
vars/slingOsgiBundleBuild.groovy | 63 +++++++++++++++++++++++++++++++++++-----
1 file changed, 55 insertions(+), 8 deletions(-)
[sling-tooling-jenkins] 02/02: SLING-7245 - Validate pull requests
using Jenkins
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git
commit 17859e668c922b9a3076c92a019297ec554f1f46
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Dec 20 16:46:05 2018 +0100
SLING-7245 - Validate pull requests using Jenkins
Initial pass at providing email notifications.
---
vars/slingOsgiBundleBuild.groovy | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 994c18e..8942b54 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -101,25 +101,53 @@ def call(Map params = [:]) {
currentBuild.result = "FAILURE"
throw e
} finally {
- processResult(currentBuild, currentBuild.getPreviousBuild()?.result)
+ processResult(currentBuild, currentBuild.getPreviousBuild()?.result, jobConfig['emailRecipients'])
}
}
}
-def processResult(def currentBuild, String previous) {
+def processResult(def currentBuild, String previous, def recipients) {
+
+ if ( !recipients ) {
+ echo "No recipients defined, not sending notifications."
+ return
+ }
String current = currentBuild.result
// values described at https://javadoc.jenkins-ci.org/hudson/model/Result.html
// Note that we don't handle consecutive failures to prevent mail spamming
- echo "Result : ${current}, previous: ${previous}"
+ def change = null;
+ def recipientProviders = []
// 1. changes from success or unknown to non-success
- if ( (previous == null || previous == "SUCCESS") && current != "SUCCESS" )
- echo "Regression"
+ if ( (previous == null || previous == "SUCCESS") && current != "SUCCESS" ) {
+ change = "BROKEN"
+ recipientProviders = [[$class: 'CulpritsRecipientProvider']]
+ }
// 2. changes from non-success to success
if ( (previous != null && previous != "SUCCESS") && current == "SUCCESS" )
- echo "Fixed"
+ change = "FIXED"
+
+ if ( change == null ) {
+ echo "No change in status, not sending notifications."
+ return
+ }
+
+ echo "Status change is ${change}, notifications will be sent."
+
+ def subject = "[Jenkins] ${currentBuild.fullDisplayName} is ${change}"
+ def body = """
+ Please see ${currentBuild.absoluteUrl} for details.
+
+ No further emails will be send until the status of the build is changed.
+
+ Build log:
+
+ ${BUILD_LOG}
+ """
+
+ emailExt subject: subject, body: body, replyTo: 'dev@sling.apache.org', recipientProviders: recipientProviders, to: 'commits@sling.apache.org'
}
\ No newline at end of file
[sling-tooling-jenkins] 01/02: SLING-7245 - Validate pull requests
using Jenkins
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git
commit 814041801dacc20649562bf3581a3504adcc3371
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Dec 20 16:46:05 2018 +0100
SLING-7245 - Validate pull requests using Jenkins
Improve exception handling to detect aborted builds.
---
vars/slingOsgiBundleBuild.groovy | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 33024c1..994c18e 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -77,8 +77,27 @@ def call(Map params = [:]) {
} else {
echo "Job is disabled, not building"
}
- } catch (Exception e) {
- // TODO - how to handle aborted builds?
+ // exception handling copied from https://github.com/apache/maven-jenkins-lib/blob/d6c76aaea9df19ad88439eba4f9d1ad6c9e272bd/vars/asfMavenTlpPlgnBuild.groovy
+ } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
+ // this ambiguous condition means a user probably aborted
+ if (e.causes.size() == 0) {
+ currentBuild.result = "ABORTED"
+ } else {
+ currentBuild.result = "FAILURE"
+ }
+ throw e
+ } catch (hudson.AbortException e) {
+ // this ambiguous condition means during a shell step, user probably aborted
+ if (e.getMessage().contains('script returned exit code 143')) {
+ currentBuild.result = "ABORTED"
+ } else {
+ currentBuild.result = "FAILURE"
+ }
+ throw e
+ } catch (InterruptedException e) {
+ currentBuild.result = "ABORTED"
+ throw e
+ } catch (Throwable e) {
currentBuild.result = "FAILURE"
throw e
} finally {