Skip to content

Commit

Permalink
Add possibility to slack failed dev build info
Browse files Browse the repository at this point in the history
Signed-off-by: mnokka-unikie <[email protected]>
  • Loading branch information
mnokka-unikie committed Jul 5, 2024
1 parent 7283078 commit 45050ac
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ghaf-main-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ pipeline {
}
}
}

post {
failure {
script {
githublink="https://github.com/tiiuae/ghaf/commit/${env.TARGET_COMMIT}"
servername = sh(script: 'uname -n', returnStdout: true).trim()
echo "Server name:$servername"
if (servername=="ghaf-jenkins-controller-dev") {
serverchannel="ghaf-jenkins-builds-failed"
echo "Slack channel:$serverchannel"
message= "FAIL build: ${servername} ${env.JOB_NAME} [${env.BUILD_NUMBER}] (<${githublink}|The commits>) (<${env.BUILD_URL}|The Build>)"
slackSend (
channel: "$serverchannel",
color: '#36a64f', // green
message: message
)
}
else {
echo "Slack message not sent (failed build). Check pipeline slack configuration!"
}
}
}
}
}

////////////////////////////////////////////////////////////////////////////////

0 comments on commit 45050ac

Please sign in to comment.