I’m working with Jenkins coverage plugin to evaluate pull request coverage, my plugin is defined
<code> discoverGitReferenceBuild(targetBranch: 'develop', scm: 'our_scm')
script {
if (env.CHANGE_TARGET != null && env.CHANGE_TARGET == 'develop'){
recordCoverage(tools: [[parser: 'JACOCO']],
id: 'jacoco', name: 'JaCoCo Coverage',
sourceCodeRetention: 'LAST_BUILD',
scm : 'our_scm',
sourceDirectories: [[path: 'glob:**/src/main/java']],
qualityGates: [[threshold: 75.0, metric: 'LINE', baseline: 'MODIFIED_LINES']])
}
</code>
<code> discoverGitReferenceBuild(targetBranch: 'develop', scm: 'our_scm')
script {
if (env.CHANGE_TARGET != null && env.CHANGE_TARGET == 'develop'){
recordCoverage(tools: [[parser: 'JACOCO']],
id: 'jacoco', name: 'JaCoCo Coverage',
sourceCodeRetention: 'LAST_BUILD',
scm : 'our_scm',
sourceDirectories: [[path: 'glob:**/src/main/java']],
qualityGates: [[threshold: 75.0, metric: 'LINE', baseline: 'MODIFIED_LINES']])
}
</code>
discoverGitReferenceBuild(targetBranch: 'develop', scm: 'our_scm')
script {
if (env.CHANGE_TARGET != null && env.CHANGE_TARGET == 'develop'){
recordCoverage(tools: [[parser: 'JACOCO']],
id: 'jacoco', name: 'JaCoCo Coverage',
sourceCodeRetention: 'LAST_BUILD',
scm : 'our_scm',
sourceDirectories: [[path: 'glob:**/src/main/java']],
qualityGates: [[threshold: 75.0, metric: 'LINE', baseline: 'MODIFIED_LINES']])
}
For some reason in some cases we get
<code>[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
</code>
<code>[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
</code>
[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
<code>
[2024-09-10T19:36:02.347Z] [Coverage] -> resolved absolute paths for all 2110 source files
[2024-09-10T19:36:02.347Z] [Coverage] Making paths of 2110 source code files relative to workspace root...
[2024-09-10T19:36:02.350Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.368Z] using credential ***
[2024-09-10T19:36:02.400Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.417Z] using credential ***
[2024-09-10T19:36:02.381Z] > git rev-parse HEAD^{commit} # timeout=10
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining action of reference build
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining reference build from reference recorder
[2024-09-10T19:36:52.908Z] [Coverage] -> Found ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using reference build '*** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Found reference result in build '#623'
[2024-09-10T19:36:52.908Z] [Coverage] Calculating the code delta...
[2024-09-10T19:36:52.908Z] [Coverage] -> Git delta calculator successfully created in working tree '***'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit 'f142b65' as latest commit for build ' *** PR-930 #7'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit '0c37474' as latest commit for build ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Invoking Git delta calculator for determining the changes between commits 'f142b65' and '0c37474'
[2024-09-10T19:36:52.908Z] [Coverage] Preprocessing code changes...
[2024-09-10T19:36:52.908Z] [Coverage] Successfully mapped SCM paths to coverage report paths
[2024-09-10T19:36:52.908Z] [Coverage] Successfully verified that the coverage data matches with the code delta
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining code changes for files...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining indirect coverage changes...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining coverage delta for files...
[2024-09-10T19:36:52.908Z] [Coverage] Calculating coverage deltas...
[2024-09-10T19:36:52.908Z] [Coverage] Evaluating quality gates
[2024-09-10T19:36:52.908Z] [Coverage] -> All quality gates have been passed
[2024-09-10T19:36:52.908Z] [Coverage] -> Details for each quality gate:
[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
[2024-09-10T19:36:52.908Z] [Coverage] Executing source code painting...
</code>
<code>
[2024-09-10T19:36:02.347Z] [Coverage] -> resolved absolute paths for all 2110 source files
[2024-09-10T19:36:02.347Z] [Coverage] Making paths of 2110 source code files relative to workspace root...
[2024-09-10T19:36:02.350Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.368Z] using credential ***
[2024-09-10T19:36:02.400Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.417Z] using credential ***
[2024-09-10T19:36:02.381Z] > git rev-parse HEAD^{commit} # timeout=10
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining action of reference build
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining reference build from reference recorder
[2024-09-10T19:36:52.908Z] [Coverage] -> Found ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using reference build '*** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Found reference result in build '#623'
[2024-09-10T19:36:52.908Z] [Coverage] Calculating the code delta...
[2024-09-10T19:36:52.908Z] [Coverage] -> Git delta calculator successfully created in working tree '***'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit 'f142b65' as latest commit for build ' *** PR-930 #7'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit '0c37474' as latest commit for build ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Invoking Git delta calculator for determining the changes between commits 'f142b65' and '0c37474'
[2024-09-10T19:36:52.908Z] [Coverage] Preprocessing code changes...
[2024-09-10T19:36:52.908Z] [Coverage] Successfully mapped SCM paths to coverage report paths
[2024-09-10T19:36:52.908Z] [Coverage] Successfully verified that the coverage data matches with the code delta
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining code changes for files...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining indirect coverage changes...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining coverage delta for files...
[2024-09-10T19:36:52.908Z] [Coverage] Calculating coverage deltas...
[2024-09-10T19:36:52.908Z] [Coverage] Evaluating quality gates
[2024-09-10T19:36:52.908Z] [Coverage] -> All quality gates have been passed
[2024-09-10T19:36:52.908Z] [Coverage] -> Details for each quality gate:
[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
[2024-09-10T19:36:52.908Z] [Coverage] Executing source code painting...
</code>
[2024-09-10T19:36:02.347Z] [Coverage] -> resolved absolute paths for all 2110 source files
[2024-09-10T19:36:02.347Z] [Coverage] Making paths of 2110 source code files relative to workspace root...
[2024-09-10T19:36:02.350Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.368Z] using credential ***
[2024-09-10T19:36:02.400Z] The recommended git tool is: NONE
[2024-09-10T19:36:02.417Z] using credential ***
[2024-09-10T19:36:02.381Z] > git rev-parse HEAD^{commit} # timeout=10
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining action of reference build
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining reference build from reference recorder
[2024-09-10T19:36:52.908Z] [Coverage] -> Found ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using reference build '*** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Found reference result in build '#623'
[2024-09-10T19:36:52.908Z] [Coverage] Calculating the code delta...
[2024-09-10T19:36:52.908Z] [Coverage] -> Git delta calculator successfully created in working tree '***'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit 'f142b65' as latest commit for build ' *** PR-930 #7'
[2024-09-10T19:36:52.908Z] [Coverage] -> Using commit '0c37474' as latest commit for build ' *** #623'
[2024-09-10T19:36:52.908Z] [Coverage] -> Invoking Git delta calculator for determining the changes between commits 'f142b65' and '0c37474'
[2024-09-10T19:36:52.908Z] [Coverage] Preprocessing code changes...
[2024-09-10T19:36:52.908Z] [Coverage] Successfully mapped SCM paths to coverage report paths
[2024-09-10T19:36:52.908Z] [Coverage] Successfully verified that the coverage data matches with the code delta
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining code changes for files...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining indirect coverage changes...
[2024-09-10T19:36:52.908Z] [Coverage] Obtaining coverage delta for files...
[2024-09-10T19:36:52.908Z] [Coverage] Calculating coverage deltas...
[2024-09-10T19:36:52.908Z] [Coverage] Evaluating quality gates
[2024-09-10T19:36:52.908Z] [Coverage] -> All quality gates have been passed
[2024-09-10T19:36:52.908Z] [Coverage] -> Details for each quality gate:
[2024-09-10T19:36:52.908Z] [Coverage] -> [Modified code lines - Line Coverage]: ≪Not built≫ - (Actual value: n/a, Quality gate: 75.00)
[2024-09-10T19:36:52.908Z] [Coverage] Executing source code painting...