Send notification on abort
@@ -49,9 +49,9 @@ pipeline {
}
post {
- failure {
+ always {
script {
- if (env.BRANCH_NAME == 'master') {
+ if ((env.BRANCH_NAME == 'master') && (currentBuild.currentResult == "ABORTED" || currentBuild.currentResult == "FAILURE")){
script {
def data = [text: "Attention! ${BUILD_TAG} job failed, see: ${BUILD_URL}"]
writeJSON(file: 'data.txt', json: data, pretty: 4)
@@ -59,11 +59,7 @@ pipeline {
sh '''curl -X POST -H 'Content-type: application/json' --data-binary "@data.txt" https://hooks.slack.com/services/${SLACK_TOKEN}'''
}
- }
- }
- always {
- script {
for (service in ["assisted-service","postgres","scality","createimage"]) {
sh "kubectl get pods -o=custom-columns=NAME:.metadata.name -A | grep ${service} | xargs -r -I {} sh -c \"kubectl logs {} -n assisted-installer > {}.log\" || true"
}
