Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70661

GitLab Pipeline Status: wrong result notification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None
    • Jenkins 2.375.1
      GitLab Branch Source Version 643.vdc12a_4a_06434

      Running `checkout scm` in a multibranch pipeline may result in wrongly notifying GitLab that the build run successfully even if the build is not finished, yet.

      This may happen when a step (seems to be xunit in our case) sets the build result to SUCCESS. The subsequent checkout will then send a wrong notification message to GitLab, because only "null" result will trigger a "Build started..." message.

       

      stage('Build') {
        node() {
          checkout scm 
          // -> [GitLab Pipeline Status] Notifying branch build status: RUNNING job/master #1: Build started...
          ... // build
          xunit ... // seems to set currentBuild.result
        }
      }
      stage('Generate Docu') {
        node() {
          checkout scm 
          // -> [GitLab Pipeline Status] Notifying branch build status: SUCCESS job/master #1: This commit looks good.
          // from here on, GitLab records the build as successful
          ... // build Docu
          // failure
        }
      }
      // -> [Pipeline] End of Pipeline
      // -> [GitLab Pipeline Status] Notifying merge request build status: FAILED job/master #1: There was a failure building this commit.

       

      Normally, if the build fails, a final "There was a failure building this commit" message will be send at the end of the build. But, when 'Merge when pipeline succeeds' is used in GitLab, it might already be too late and the merge had already been done.

      Additionally, we also hit JENKINS-70010 quite regularly. The "scm" gets transformed into a NullSCM. In this case, no final message will be send at all, leaving the build status in GitLab as "Success" even if the build actually failed. (as the branch was already removed as part of the merge no further signalling was done)

            gordin Christoph Vogtländer
            gordin Christoph Vogtländer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: