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

Failed quality gate does not prevent whole pipeline execution

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • warnings-ng-plugin
    • Jenkins 2.426.2
      Warnings NG plugin 10.5.3

      While executing the recordIssues step with a defined quality gate to set stage and build results to "failed", it just sets status, but it doesn't prevent execution of the rest of the pipeline and I'm not sure if this is the expected behavior.

      In my case, I'm executing whole security checks before uploading built artifacts, and I would like to prevent this step execution for artifacts that do not meet specific security requirements (defined via quality gate). But even if the "Security scans" stage and even the whole build are set to "failed" due to the quality gate status, the next stages, including "Upload artifacts", are still executed.
       

      pipeline {
          agent {...}
      
          stages {
              stage("Earlier stages") {...}
              
              stage("Security scans") {
                  makeSecurityScans()
                  recordIssues tools: [...], qualityGates: [[threshold: 1, type: 'TOTAL_ERROR', unstable: false]]
              }
      
              stage("Upload artifacts") {
                  uploadArtifacts()
              }
          }
      }
      

          [JENKINS-72575] Failed quality gate does not prevent whole pipeline execution

          Łukasz Jackiewicz created issue -
          Ulli Hafner made changes -
          Link New: This issue duplicates JENKINS-72059 [ JENKINS-72059 ]

          Ulli Hafner added a comment -

          Ulli Hafner added a comment - See https://github.com/jenkinsci/warnings-ng-plugin/pull/1649
          Ulli Hafner made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Łukasz Jackiewicz added a comment - - edited

          Before creating the issue, I was already looking through the open issues list and noticed JENKINS-72059, but unfortunately it's not a duplicate of my issue.

          Łukasz Jackiewicz added a comment - - edited Before creating the issue, I was already looking through the open issues list and noticed JENKINS-72059 , but unfortunately it's not a duplicate of my issue.

          The unexpected behavior here is the execution of subsequent stages of the pipeline even though the stage calling the recordIssue step has been marked as failed by it.

          And it doesn't make much sense to me.

          An example of the functionality I am writing about was implemented, among others, in the OWASP DependencyCheck plugin and is available there via the additional stopBuild flag of the dependencyCheckPublisher step.

          Łukasz Jackiewicz added a comment - The unexpected behavior here is the execution of subsequent stages of the pipeline even though the stage calling the recordIssue step has been marked as failed by it. And it doesn't make much sense to me. An example of the functionality I am writing about was implemented, among others, in the OWASP DependencyCheck plugin and is available there via the additional stopBuild flag of the dependencyCheckPublisher step.

          Ulli Hafner added a comment -

          Sorry, it seems that I misunderstood the problem.

          I am not aware that a plugin can stop a build. How can we achieve that? Shouldn't this be a Jenkins core or pipeline option how to handle unstable or failed results of a step?

          Ulli Hafner added a comment - Sorry, it seems that I misunderstood the problem. I am not aware that a plugin can stop a build. How can we achieve that? Shouldn't this be a Jenkins core or pipeline option how to handle unstable or failed results of a step?
          Ulli Hafner made changes -
          Resolution Original: Duplicate [ 3 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Ulli Hafner made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Łukasz Jackiewicz made changes -
          Attachment New: dependency-check.PNG [ 61971 ]

            Unassigned Unassigned
            ljackiewicz Łukasz Jackiewicz
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: