-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major
-
Component/s: warnings-ng-plugin
-
None
-
Environment:Jenkins 2.165, mac OS
I find that for example, using PMD Parser when the recordIssues has a quality gate set and there is a failure case for the quality gate, the build is not 'halted' and the next pipeline step executes, though the build is marked failed. if 'unstable: true' is set, the build is marked unstable and halts, but not when 'unstable: false'
Â
My understanding and expectation here is that if recordIssues determines the quality gate FAILS, the build should be marked failed AND no following Pipeline steps should execute.  Â
Â
According to docs here
the build should fail.
Â
Example I have here in declarative pipeline:
stage("PMD Check") { steps { sh "./gradlew --no-daemon pmd" } post { always { recordIssues referenceJobName: 'mobileheros_multibranch/develop', enabledForFailure: true, qualityGates: [[threshold: 685, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'NEW', unstable: false]], tools: [pmdParser(pattern: 'Rewards/build/reports/pmd/*.xml')] } } } stage("TEST ME") { steps { echo "WHY DID THIS EXECUTE???" } }
Â
log from Jenkins:
BUILD SUCCESSFUL in 2m 23s
1 actionable task: 1 executedPost stage[Pipeline] stepusing credential ***
[PMD] Searching for all files in '/Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/workspace' that match the pattern 'Rewards/build/reports/pmd/*.xml'
[PMD] -> found 1 file
[PMD] Successfully parsed file /Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/workspace/Rewards/build/reports/pmd/pmd.xml
[PMD] -> found 14604 issues (skipped 2001 duplicates)
> git rev-parse HEAD^{commit} # timeout=10
[PMD] Post processing issues on 'Master' with source code encoding 'UTF-8'
[PMD] Resolving absolute file names for all issues in workspace '/Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/workspace'
[PMD] -> 0 resolved, 0 unresolved, 925 already resolved
[PMD] Copying affected files to Jenkins' build folder '/Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/builds/2/files-with-issues'
[PMD] -> 925 copied, 0 not in workspace, 0 not-found, 0 with I/O error
[PMD] Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)
[PMD] -> resolved module names for 14604 issues
[PMD] Resolving package names (or namespaces) by parsing the affected files
[PMD] -> all affected files already have a valid package name
[PMD] No filter has been set, publishing all 14604 issues
[PMD] Creating fingerprints for all affected code blocks to track issues over different builds
[PMD] -> created fingerprints for 14604 issues
[PMD] Invoking Git blamer to create author and commit information for all affected files
[PMD] GIT_COMMIT env = 'HEAD'
[PMD] Git working tree = '/Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/workspace'
[PMD] Git commit ID = '434b4d1f9b677d54fadd57550ac3af7d4d3a1325'
[PMD] Job workspace = '/Users/Shared/Jenkins/Home/jobs/POC Pipeline/branches/develop/workspace'
[PMD] Created blame requests for 925 files - invoking Git blame on agent for each of the requests
[PMD] -> blamed authors of issues in 925 files
[PMD] Attaching ResultAction with ID 'pmd' to run 'POC Pipeline/develop #2'.
[PMD] Using reference build 'mobileheros_multibranch/develop #204' to compute new, fixed, and outstanding issues
[PMD] Issues delta (vs. reference build): outstanding: 14600, new: 4, fixed: 6
[PMD] Evaluating quality gates
[PMD] -> PASSED - Total number of warnings (severity high): 451 - Quality QualityGate: 685
[PMD] -> FAILED - Number of new issues (any severity): 4 - Quality QualityGate: 1
[PMD] -> Some quality gates have been missed: overall result is FAILED
[PMD] Health report is disabled - skipping
[PMD] Created analysis result for 14604 issues (found 4 new issues, fixed 6 issues)[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline]
[Pipeline] // stage[Pipeline] stage[Pipeline] { (Declarative: Post Actions)[Pipeline] echoFINALLY DONE WITH RESULT=FAILURE[Pipeline] sh
- duplicates
-
JENKINS-54373 Quality Gate failure doesn't fail the step.
-
- Resolved
-