Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 20cccdf6 authored by Ben Cooksley's avatar Ben Cooksley

Provide for an option to only send CI notification emails when a build has failed.

Ref T7583
parent edb130e1
......@@ -21,7 +21,8 @@ knownJobs.each {
|def branchGroup = "${it.branchGroup}"
|def currentPlatform = "${it.platform}"
|def ciEnvironment = "${it.environment}"
|def emailRecipients = "${it.notifyByEmail}"
|def buildFailureEmails = "${it.buildFailureEmails}"
|def unstableBuildEmails = "${it.unstableBuildEmails}"
|${pipelineTemplate}""".stripMargin()
......
......@@ -84,12 +84,13 @@ for product in productHandler.knownProducts():
if branchToBuild is None or branchToBuild == '':
continue
# Grab the list of email addresses we need to notify
notifyByEmail = productHandler.notificationsFor( product, project )
# Make sure the global list for KDE is in the list
notifyByEmail.append('kde-dashboard@kde.org')
# Convert it to a comma separated list, which is what Jenkins email-ext plugin wants
notifyByEmail = ', '.join( notifyByEmail )
# Grab the list of email addresses we need to notify for build failures
buildFailureEmails = productHandler.notificationsFor( product, project, failuresOnly = True )
buildFailureEmails = ', '.join( buildFailureEmails )
# Grab the list of email addresses we need to notify for unstable builds (failing tests)
unstableBuildEmails = productHandler.notificationsFor( product, project, failuresOnly = False )
unstableBuildEmails = ', '.join( unstableBuildEmails )
# We have a winner!
jobEntry = {
......@@ -102,7 +103,8 @@ for product in productHandler.knownProducts():
'platform': platform,
'description': project.description,
'environment': arguments.environment,
'notifyByEmail': notifyByEmail
'buildFailureEmails': buildFailureEmails,
'unstableBuildEmails': unstableBuildEmails
}
# Store it
......
......@@ -351,7 +351,7 @@ class ProductHandler(object):
# Remove duplicates and return the list
return list(set(matchingProjects))
def notificationsFor(self, product, project):
def notificationsFor(self, product, project, failuresOnly = False):
# Do we have any notification rules for this Product?
if 'notifications' not in self.productsData[ product ]:
# Nothing for us to do if we don't have any rules to look at
......@@ -364,6 +364,10 @@ class ProductHandler(object):
# Let's start going over the rules
for rule in notificationRules:
# Should we be considering this rule?
if 'failuresOnly' in rule and rule['failuresOnly'] != failuresOnly:
continue
# Does the rule match?
if fnmatch.fnmatch( project.path, rule['match'] ):
# Add this rules address to the list then
......
......@@ -33,6 +33,7 @@
notifications:
- match: "frameworks/*"
to: "kde-frameworks-devel@kde.org"
failuresOnly: false
"Plasma":
includes:
......@@ -50,8 +51,10 @@
notifications:
- match: "frameworks/*"
to: "plasma-devel@kde.org"
failuresOnly: true
- match: "kde/workspace/*"
to: "plasma-devel@kde.org"
failuresOnly: true
"Applications":
includes:
......@@ -95,10 +98,13 @@
notifications:
- match: "kde/applications/dolphin"
to: "kfm-devel@kde.org"
failuresOnly: false
- match: "kde/kdeutils/*"
to: "kde-utils-devel@kde.org"
failuresOnly: false
- match: "kde/kdegraphics/okular"
to: "okular-devel@kde.org"
failuresOnly: false
"Extragear":
includes:
......@@ -159,20 +165,28 @@
"notifications":
- match: "extragear/utils/kronometer"
to: "kde-utils-devel@kde.org"
failuresOnly: false
- match: "extragear/graphics/digikam"
to: "digikam-devel@kde.org"
failuresOnly: false
- match: "extragear/sdk/clazy"
to: "smartins@kde.org"
failuresOnly: false
- match: "extragear/pim/zanshin"
to: "zanshin-devel@kde.org"
failuresOnly: false
- match: "extragear/edu/labplot"
to: "stefan.gerlach@uni-konstanz.de"
failuresOnly: false
- match: "extragear/edu/labplot"
to: "alexander.semke@web.de"
failuresOnly: false
- match: "extragear/edu/kstars"
to: "csaba.kertesz@gmail.com"
failuresOnly: false
- match: "extragear/edu/kstars"
to: "mutlaqja@ikarustech.com"
failuresOnly: false
"KDevelop":
includes:
......
......@@ -123,10 +123,21 @@ timestamps {
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed, is FAILURE or UNSTABLE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// Start constructing the list of our recipients
// At this point we can only be either a failure or an unstable build, so notify those who have requested unstable build notifications
def mailTo = [ unstableBuildEmails ]
// If the build was a solid failure (either now or previously) then notify those who want to know about failures only
if( previousResult == 'FAILURE' || currentBuild.result == 'FAILURE' ) {
// Add them to the list
mailTo << buildFailureEmails
}
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// We always want to notify our dashboard as well
mailTo << "kde-dashboard@kde.org"
// Finalise the list of recipients
mailTo = mailTo.join(',')
......
......@@ -135,10 +135,21 @@ timestamps {
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed, is FAILURE or UNSTABLE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// Start constructing the list of our recipients
// At this point we can only be either a failure or an unstable build, so notify those who have requested unstable build notifications
def mailTo = [ unstableBuildEmails ]
// If the build was a solid failure (either now or previously) then notify those who want to know about failures only
if( previousResult == 'FAILURE' || currentBuild.result == 'FAILURE' ) {
// Add them to the list
mailTo << buildFailureEmails
}
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// We always want to notify our dashboard as well
mailTo << "kde-dashboard@kde.org"
// Finalise the list of recipients
mailTo = mailTo.join(',')
......
......@@ -156,10 +156,21 @@ timestamps {
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed, is FAILURE or UNSTABLE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// Start constructing the list of our recipients
// At this point we can only be either a failure or an unstable build, so notify those who have requested unstable build notifications
def mailTo = [ unstableBuildEmails ]
// If the build was a solid failure (either now or previously) then notify those who want to know about failures only
if( previousResult == 'FAILURE' || currentBuild.result == 'FAILURE' ) {
// Add them to the list
mailTo << buildFailureEmails
}
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// We always want to notify our dashboard as well
mailTo << "kde-dashboard@kde.org"
// Finalise the list of recipients
mailTo = mailTo.join(',')
......
......@@ -156,10 +156,21 @@ timestamps {
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed, is FAILURE or UNSTABLE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// Start constructing the list of our recipients
// At this point we can only be either a failure or an unstable build, so notify those who have requested unstable build notifications
def mailTo = [ unstableBuildEmails ]
// If the build was a solid failure (either now or previously) then notify those who want to know about failures only
if( previousResult == 'FAILURE' || currentBuild.result == 'FAILURE' ) {
// Add them to the list
mailTo << buildFailureEmails
}
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// We always want to notify our dashboard as well
mailTo << "kde-dashboard@kde.org"
// Finalise the list of recipients
mailTo = mailTo.join(',')
......
......@@ -143,10 +143,21 @@ timestamps {
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed or is FAILURE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILURE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// Start constructing the list of our recipients
// At this point we can only be either a failure or an unstable build, so notify those who have requested unstable build notifications
def mailTo = [ unstableBuildEmails ]
// If the build was a solid failure (either now or previously) then notify those who want to know about failures only
if( previousResult == 'FAILURE' || currentBuild.result == 'FAILURE' ) {
// Add them to the list
mailTo << buildFailureEmails
}
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// We always want to notify our dashboard as well
mailTo << "kde-dashboard@kde.org"
// Finalise the list of recipients
mailTo = mailTo.join(',')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment