Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: warnings-ng-plugin
    • Labels:
      None
    • Environment:
      jenkins 2.165
      warnings-ng 3.0.3
    • Similar Issues:

      Description

      Running recordIssues never fails stage even output tells it fails.

      This is the stage (not parallel!) snippet from my pipeline:

              stage('Analyze test results') {
                  steps {
                      unstash 'pylint.log'
                      recordIssues healthy: 1, minimumSeverity: 'NORMAL', unhealthy: 9, qualityGates: [[threshold: 1, type: 'TOTAL_NORMAL', unstable: true], [threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]], tools: [pyLint(pattern: 'pylint/pylint.log')]
                  }
                  post {
                      failure {
                          error('Abort because of pylint warnings')
                      }
                  }
              }
      

      ... and this is the output:

      [Pipeline] stage
      [Pipeline] { (Analyze test results)
      [Pipeline] unstash
      [Pipeline] recordIssues
      using credential itsec_git-jenkins
      [PyLint] Searching for all files in '/var/jenkins_home/workspace/somenamesystem_somename-core_test@4' that match the pattern 'pylint/pylint.log'
      [PyLint] -> found 1 file
      [PyLint] Successfully parsed file /var/jenkins_home/workspace/somenamesystem_somename-core_test@4/pylint/pylint.log
      [PyLint] -> found 3122 issues (skipped 81 duplicates)
       > git rev-parse HEAD^{commit} # timeout=10
      [PyLint] Post processing issues on 'Master' with source code encoding 'UTF-8'
      [PyLint] Resolving absolute file names for all issues in workspace '/var/jenkins_home/workspace/somenamesystem_somename-core_test@4'
      [PyLint] -> 91 resolved, 0 unresolved, 0 already resolved
      [PyLint] Copying affected files to Jenkins' build folder '/var/jenkins_home/jobs/somenamesystem/jobs/somename-core/branches/test/builds/61/files-with-issues'
      [PyLint] -> 91 copied, 0 not in workspace, 0 not-found, 0 with I/O error
      [PyLint] Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)
      [PyLint] -> resolved module names for 3122 issues
      [PyLint] Resolving package names (or namespaces) by parsing the affected files
      [PyLint] -> resolved package names of 91 affected files
      [PyLint] No filter has been set, publishing all 3122 issues
      [PyLint] Creating fingerprints for all affected code blocks to track issues over different builds
      [PyLint] -> created fingerprints for 3122 issues
      [PyLint] Invoking Git blamer to create author and commit information for all affected files
      [PyLint] GIT_COMMIT env = 'HEAD'
      [PyLint] Git working tree = '/var/jenkins_home/workspace/somenamesystem_somename-core_test@4'
      [PyLint] Git commit ID = '9753edb7b0dd8f8741b92cd9c60951d44e949b7c'
      [PyLint] Job workspace = '/var/jenkins_home/workspace/somenamesystem_somename-core_test@4'
      [PyLint] Created blame requests for 91 files - invoking Git blame on agent for each of the requests
      [PyLint] -> blamed authors of issues in 91 files
      [PyLint] Attaching ResultAction with ID 'pylint' to run 'somenamesystem/somename-core/test #61'.
      [PyLint] Using reference build 'somenamesystem/somename-core/test #60' to compute new, fixed, and outstanding issues
      [PyLint] Issues delta (vs. reference build): outstanding: 0, new: 3122, fixed: 0
      [PyLint] Evaluating quality gates
      [PyLint] -> PASSED - Total number of warnings (severity normal): 0 - Quality QualityGate: 1
      [PyLint] -> FAILED - Total number of warnings (severity high): 1 - Quality QualityGate: 1
      [PyLint] -> PASSED - Total number of errors: 0 - Quality QualityGate: 1
      [PyLint] -> Some quality gates have been missed: overall result is FAILED
      [PyLint] Enabling health report (Healthy=1, Unhealthy=9, Minimum Severity=NORMAL)
      [PyLint] Created analysis result for 3122 issues (found 3122 new issues, fixed 0 issues)
      [Pipeline] }
      [Pipeline] // stage
      

      Replacing the steps of this stage with the following code fails correctly:

              stage('Analyze test results') {
                  steps {
                      sh 'exit 1'
                  }
                  post {
                      failure {
                          error('Abort because of pylint warnings')
                      }
                  }
              }
      

      When I comment out the unstash (so the file pylint/pylint.log is unavailable), the output says it will fail because file is missing (I activated the flag in the settings for failing if file not available) - but stage also doesn't fail.

        Attachments

          Issue Links

            Activity

            Hide
            drulli Ulli Hafner added a comment -

            There is no way in Jenkins API to fail a stage, see JENKINS-54373. The warnings plugin can fail only a whole build.

            Show
            drulli Ulli Hafner added a comment - There is no way in Jenkins API to fail a stage, see JENKINS-54373 . The warnings plugin can fail only a whole build.

              People

              • Assignee:
                drulli Ulli Hafner
                Reporter:
                baaazen Mirko Hansen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: