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