Fix pipeline to delete/post GH results only if no new build initiated
@@ -457,7 +457,7 @@ pipeline {
always {
script {
setTestsresults()
- if (currentBuild.result != null && currentBuild.result != 'SUCCESS' && currentBuild.result != 'NOT_BUILT') {
+ if (currentBuild.result != null && currentBuild.result != 'SUCCESS' && currentBuild.nextBuild == null) {
try {
slackSend channel: "@${AUTHOR_NAME}", color: '#FF0000', message: "[${JOB_NAME}]: build ${currentBuild.result}, ${BUILD_URL} owner: @${AUTHOR_NAME}"
@@ -466,7 +466,7 @@ pipeline {
slackSend channel: '#cloud-dev-ci', color: '#FF0000', message: "[${JOB_NAME}]: build ${currentBuild.result}, ${BUILD_URL} owner: @${AUTHOR_NAME}"
}
}
- if (env.CHANGE_URL) {
+ if (env.CHANGE_URL && currentBuild.nextBuild == null) {
for (comment in pullRequest.comments) {
println("Author: ${comment.user}, Comment: ${comment.body}")
if (comment.user.equals('JNKPercona')) {
@@ -474,7 +474,6 @@ pipeline {
comment.delete()
}
}
- if (currentBuild.result != 'NOT_BUILT') {
makeReport()
unstash 'IMAGE'
def IMAGE = sh(returnStdout: true, script: "cat results/docker/TAG").trim()
@@ -482,7 +481,6 @@ pipeline {
pullRequest.comment(TestsReport)
}
}
- }
DeleteOldClusters("$CLUSTER_NAME")
sh """
sudo docker system prune -fa
