jenkinsci / code-coverage-api-plugin

Deprecated Jenkins Code Coverage Plugin
https://plugins.jenkins.io/code-coverage-api/
MIT License
111 stars 77 forks source link

Incorrect project delta with two recordCoverage steps #712

Closed edwardpeek-crown closed 1 year ago

edwardpeek-crown commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.387.3 OS: Linux - 5.4.0-148-generic Java: 11.0.18 - Ubuntu (OpenJDK 64-Bit Server VM) --- ... bootstrap4-api:4.6.0-5 bootstrap5-api:5.2.2-3 ... checks-api:2.0.0 ... code-coverage-api:4.4.0 ... commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ ... data-tables-api:1.13.3-3 ... display-url-api:2.3.7 ... echarts-api:5.4.0-3 ... font-awesome-api:6.3.0-2 forensics-api:2.1.0 ... ionicons-api:45.vf54fca_5d2154 ... jackson2-api:2.15.0-334.v317a_165f9b_7c ... jquery3-api:3.6.4-1 ... pipeline-build-step:491.v1fec530da_858 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2131.vb_9788088fdb_5 pipeline-model-definition:2.2131.vb_9788088fdb_5 pipeline-model-extensions:2.2131.vb_9788088fdb_5 pipeline-rest-api:2.32 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2131.vb_9788088fdb_5 pipeline-stage-view:2.32 ... plugin-util-api:3.2.0 ... prism-api:1.29.0-4 ... ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu Jammy 22.04

Reproduction steps

// Some time later...

recordCoverage( // Implicit id: 'coverage', ? name: 'Test Coverage', tools: [[parser: 'COBERTURA', pattern: "${env.CC_BUILD_ARTIFACTS}/pycoverage.xml"]], failOnError: true, )



### Expected Results

Coverage deltas are calculated peer-wise for each recordCoverage step with different IDs.

ie. Test Coverage Line Coverage delta = 66.48% - 66.41% = +0.07%

### Actual Results

The project delta for the "Test Coverage" step is incorrectly computed against the "Type Coverage" from the reference build.

Branch:
![image](https://github.com/jenkinsci/code-coverage-api-plugin/assets/44851039/31c10da7-ce0d-4b56-961a-178b58192c53)

Reference master build \#953:
![image](https://github.com/jenkinsci/code-coverage-api-plugin/assets/44851039/c9c405c9-3b8b-47f7-baa4-5ea10636ca75)

ie. Test Coverage Line Coverage delta = 66.48% - 45.09% ~= +21.38%

### Anything else?

This also happens with subsequent builds in the master pipeline branch.
uhafner commented 1 year ago

Fixed in https://github.com/jenkinsci/code-coverage-api-plugin/releases/tag/v4.5.0

uhafner commented 1 year ago

Please keep your plugins (and Jenkins installation) up to date!

edwardpeek-crown commented 1 year ago

My mistake, missed that searching through old issues.

Thanks for the response! We're all good now after updating.