Commit 5171d236 authored by Ben Cooksley's avatar Ben Cooksley

Initial part of an implementation of:

1) Build emails for failing / unstable builds
2) Capturing workspaces for failing or unstable builds
parent 43ec6c05
......@@ -21,6 +21,7 @@ knownJobs.each {
|def branchGroup = "${it.branchGroup}"
|def currentPlatform = "${it.platform}"
|def ciEnvironment = "${it.environment}"
|def emailRecipients = "bcooksley@kde.org"
|${pipelineTemplate}""".stripMargin()
......
// Request a node to be allocated to us
node( currentPlatform ) {
// We want Timestamps on everything
timestamps {
// We want Timestamps on everything
timestamps {
// We want to catch any errors that occur to allow us to send out notifications (ie. emails) if needed
catchError {
// First Thing: Checkout Sources
stage('Checkout Sources') {
// Actual Application Sources
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
......@@ -131,23 +132,47 @@ node( currentPlatform ) {
zoomCoverageChart: false
])
// Scan the logs and publish a warnings report
warnings consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)'], [parserName: 'Appstreamercli']], excludePattern: '/tmp/**'
warnings consoleParsers: [[parserName: 'GNU Make + GNU C Compiler (gcc)'], [parserName: 'Appstreamercli']], excludePattern: "/tmp/**"
}
// Send an email notification of this
/*emailext(
to: 'ci-builds@kde.org',
body: '${JELLY_SCRIPT,template="text"}',
}
// The build has been completed now - it either succeeded, is unstable, or failed
// These parts aren't run within a stage as they're purely administrative and their output will be minimal if any exists
// First, do we need to capture a copy of the Workspace? We do this if it was unstable or failed
// This is to allow developers to examine what happened more easily
if( currentBuild.result == 'FAILED' || currentBuild.result == 'UNSTABLE' ) {
// Capture the workspace
sh "python3 -u ci-tooling/helpers/capture-workspace.py --environment ${ciEnvironment}"
}
// Let's determine if we need to send out notifications
// What happened in our previous build?
def previousResult = currentBuild.previousBuild?.result
// If our condition has changed, is FAILED or UNSTABLE then we want to send an email
if( previousResult != currentBuild.result || currentBuild.result == 'FAILED' || currentBuild.result == 'UNSTABLE' ) {
// Construct the list of our recipients - starting with the ones requested as part of our job
def mailTo = [ emailRecipients ]
// If someone kicked this job off, they're presumably interested as well
mailTo << emailextrecipients( [[$class: 'RequesterRecipientProvider']] )
// Finalise the list of recipients
mailTo = mailTo.join(',')
// Send the email now
emailext(
to: mailTo,
body: '${JELLY_SCRIPT,template="html_gmail"}',
subject: 'KDE CI: ${PROJECT_NAME} - Build # ${BUILD_NUMBER} - ${BUILD_STATUS}!',
attachLog: true
)*/
// IRC Notifications are currently not supported by Pipeline
// See https://issues.jenkins-ci.org/browse/JENKINS-33922
// We can probably workaround this using Pursuivant and the emails Jenkins sends out
// This would allow subscribing to build notifications for IRC channels in much the same way one subscribes for Commits and Bugzilla changes
)
}
// IRC Notifications are currently not supported by Pipeline
// See https://issues.jenkins-ci.org/browse/JENKINS-33922
// We can probably workaround this using Pursuivant and the emails Jenkins sends out
// This would allow subscribing to build notifications for IRC channels in much the same way one subscribes for Commits and Bugzilla changes
}
}
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