jenkinsci / github-autostatus-plugin

Jenkins plugin to provide automatic status for multibranch jobs
https://plugins.jenkins.io/github-autostatus/
MIT License
52 stars 34 forks source link

Jenkins declarative pipeline skipped stages marked as 'CompletedError' when build failed #99

Open serdar-luminar opened 4 years ago

serdar-luminar commented 4 years ago

When Jenkins declarative pipeline parallel build fails due to stage failure, rest of the skipped stages result marked as 'CompletedError' Skipped stage's result should be marked as 'SkippedFailure' (BuildStage.State.SkippedFailure) Because of this, whenever I look at the build errors, I see many stages counted as failed even thought there is only one stage fails the build. Steps to reproduce:

  1. Define declarative pipeline with parallel stage, fail a stage and all the skipped following stage result in stage table will be "CompletedError"\

https://github.com/jenkinsci/github-autostatus-plugin/blob/07544fc6902af9a5519f16dec5504f4e3cd8bc18/src/main/java/org/jenkinsci/plugins/githubautostatus/model/BuildState.java

2020-05-26T22:32:38.810161877Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Checkout                         25155     Push event to branch develop
2020-05-26T22:32:39.349687469Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Query changesets                 284       Push event to branch develop
2020-05-26T22:33:11.070330713Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Linters                          18049     Push event to branch develop
2020-05-26T22:35:20.06313541Z  none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Build Libs                       128717    Push event to branch develop
2020-05-26T22:35:22.605680345Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess clang-tidy analysis              2106      Push event to branch develop
2020-05-26T22:37:05.868037938Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Unit Tests                       10418     Push event to branch develop
2020-05-26T22:37:27.519208594Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Build External Samples           21266     Push event to branch develop
2020-05-26T22:37:27.830639555Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Archive Artifacts                58        Push event to branch develop
2020-05-26T22:37:29.61714952Z  none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Provision Windows x64 Internal   289658    Push event to branch develop
2020-05-26T22:37:29.84766762Z  none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess win-x64                          290089    Push event to branch develop
2020-05-26T22:38:26.25402246Z  none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Build Internal Samples           29375     Push event to branch develop
2020-05-26T22:39:08.701084008Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop CompletedSuccess Integration Tests                42147     Push event to branch develop
2020-05-26T22:39:33.330318407Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   script returned exit code 1      0         Push event to branch develop
2020-05-26T22:39:33.581639976Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Metrics                          51        Push event to branch develop
2020-05-26T22:39:33.877336267Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Lachesis Profiler                40        Push event to branch develop
2020-05-26T22:39:34.165243518Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Runtime Profiler                 42        Push event to branch develop
2020-05-26T22:39:34.500624142Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Build and Deploy Artifacts       45        Push event to branch develop
2020-05-26T22:39:37.600948578Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Provision Native Xavier Internal 417483    Push event to branch develop
2020-05-26T22:39:38.014681296Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   aarch64                          418234    Push event to branch develop
2020-05-26T22:39:45.060509058Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   null                             0         Push event to branch develop
2020-05-26T22:39:45.874334766Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop Aborted          Trigger Artifact testing job     51        Push event to branch develop
2020-05-26T22:39:51.420424639Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop Aborted          Provision X86 Docker Internal    431223    Push event to branch develop
2020-05-26T22:39:51.823609545Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 1      develop Aborted          x86                              432061    Push event to branch develop
2020-05-26T22:39:52.434169903Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Parallel Architectures           432858    Push event to branch develop
2020-05-26T22:39:53.31139658Z  none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   DataServices                     332       Push event to branch develop
2020-05-26T22:39:53.534058023Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Provision X86 Docker DataInfra   830       Push event to branch develop
2020-05-26T22:39:54.266275104Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   LumLabeling                      236       Push event to branch develop
2020-05-26T22:39:54.512768394Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Provision x86 LumLabeling        673       Push event to branch develop
2020-05-26T22:39:55.201227924Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   DataHub                          185       Push event to branch develop
2020-05-26T22:39:55.423769121Z none   899         job/LumPDK/job/develop/899/ LumPDK/develop#899 LumPDK 0      develop CompletedError   Provision x86 DataHub            614       Push event to branch develop
mrtnlrsn commented 3 years ago

I think I see the same (but without any parallel steps). The script below marks both steps as failed, though build step should be marked as not run.

pipeline {
    agent any
    stages {
        stage('clone') {
            steps {
                sh 'exit 1'
            }
        }
        stage('build') {
            steps {
                echo '2'
            }
        }
    }
}