Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pipeline {
booleanParam(name: 'deploy', defaultValue: false)
booleanParam(name: 'invalidate_cache', defaultValue: false)
string(name: 'apt_refresh_key')
booleanParam(name: 'slack_notifications_enabled', defaultValue: false)
string(name: 'slack_notifications_channel', defaultValue: '')
}

options {
Expand Down Expand Up @@ -79,6 +81,7 @@ pipeline {
agent any
steps {
script {
error "Intentional failure for Slack bot testing"
dir('tailor-image') {
checkout(scm)
}
Expand Down Expand Up @@ -129,6 +132,11 @@ pipeline {
cleanDocker()
deleteDir()
}
failure {
script {
FAILED_STAGE = "Build tailor-image"
}
}
}
}

Expand Down Expand Up @@ -204,6 +212,32 @@ pipeline {
parallel(jobs)
}
}
post {
failure {
script {
FAILED_STAGE = "Create images"
}
}
}
}
}
// Slack bot to notify of any step failure
post {
failure {
script {
if (params.slack_notifications_enabled && (params.rosdistro_job == '/ci/rosdistro/master' || params.rosdistro_job.startsWith('/ci/rosdistro')))
{
slackSend(
channel: params.slack_notifications_channel,
color: 'danger',
message: """
*Build failure* for `${params.release_label}` (<${env.RUN_DISPLAY_URL}|Open>)
*Sub-pipeline*: tailor-image
*Stage*: ${FAILED_STAGE ?: 'unknown'}
"""
)
}
}
}
}
}
Loading