Commit f6d250ee authored by Guido Gunther's avatar Guido Gunther
Browse files

Send mails on package build failures

For now send them to myself only. Once this works we can switch to a
list.
parent 60ea143d
......@@ -36,6 +36,9 @@ def native_archs = [ primary_arch, 'amd64' ]
// Artifacts
def artifacts = '*.deb'
// Who get's mail notifications
def email_to = 'guido.gunther@puri.sm'
// Load jobs from YAML file
Yaml yaml = new Yaml()
def jobsfile = (new File(__FILE__)).parent + '/jobs.yml'
......@@ -98,35 +101,45 @@ pkgs.each { pkg ->
properties properties: [
disableConcurrentBuilds()
]
stage('Build Debian Package') {
node ('${build_node_label}') {
checkout([
userRemoteConfigs: [[url: '${params.url}']],
\$class: 'GitSCM',
branches: [[name: '${branch}']],
extensions: [[\$class: 'RelativeTargetDirectory',
relativeTargetDir: 'build'],
],
])
sh '''${build_cmd}'''
stash name: '${stash}', allowEmpty: false, includes: "${uploads.replaceAll(' ',',')}"
try {
stage('Build Debian Package') {
node ('${build_node_label}') {
checkout([
userRemoteConfigs: [[url: '${params.url}']],
\$class: 'GitSCM',
branches: [[name: '${branch}']],
extensions: [[\$class: 'RelativeTargetDirectory',
relativeTargetDir: 'build'],
],
])
sh '''${build_cmd}'''
stash name: '${stash}', allowEmpty: false, includes: "${uploads.replaceAll(' ',',')}"
}
}
}
stage('Upload Debian Packages') {
node ('${upload_node_label}') {
sh 'rm -f ${uploads}'
unstash '${stash}'
sh '''${upload_cmd}'''
stage('Upload Debian Packages') {
node ('${upload_node_label}') {
sh 'rm -f ${uploads}'
unstash '${stash}'
sh '''${upload_cmd}'''
}
}
}
stage('Save Artifacts') {
node ('${upload_node_label}') {
archiveArtifacts '${artifacts}'
stage('Save Artifacts') {
node ('${upload_node_label}') {
archiveArtifacts '${artifacts}'
}
}
} catch(err) {
currentBuild.result = 'FAILURE'
emailext body: '\${DEFAULT_CONTENT}',
replyTo: '\$DEFAULT_REPLYTO',
subject: '\${DEFAULT_SUBJECT}',
to: '${email_to}'
// Rethrow error
throw err
}
}
}
""".stripIndent())
}
}
......
Supports Markdown
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