jenkinsci / cobertura-plugin

Jenkins cobertura plugin
https://plugins.jenkins.io/cobertura/
MIT License
109 stars 133 forks source link

Dependency to deprecated / EOL code-coverage-api #219

Closed offa closed 3 months ago

offa commented 8 months ago

Jenkins and plugins versions report

any

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

any

Reproduction steps

a. See Jenkins UI warning b. See code-coverage-api project (eg. https://github.com/jenkinsci/code-coverage-api-plugin)

Expected Results

Migration to Coverage Plugin (as suggested in the docs)

Actual Results

Deprecated / EOL dependency is used

Anything else?

The new Coverage plugin seems not to be a drop in replacement and code changes are likely needed.

Are you interested in contributing a fix?

No response

jamiejackson commented 3 months ago

Maybe you'd have better luck on the Jira tracker. I'm not sure which tracker gets more attention.

It might also be useful to try to get some attention from the coverage plugin side. While it has a GitHub repo, its maintainers are clear that Jira is its only issue tracker (versus cobertura, which lists both Jira and GitHub trackers).

I have a PR for this (#224). While I think I made some progress, I did hit a roadblock with a dependency version conflict.

jgournet commented 3 months ago

Someone created a ticket: https://issues.jenkins.io/browse/JENKINS-73238 (thank you !). Their answer was: functionality from cobertura plugin should be included in "coverage" ... so we can just remove it

jamiejackson commented 3 months ago

Thanks, @jgournet . Let us know what happens if and when you try it out.

offa commented 3 months ago

Indeed, Coverage is a better choice. Let's close here then.

captain-caveman2k commented 2 months ago

Their answer was: functionality from cobertura plugin should be included in "coverage" ... so we can just remove it

Apologies for my ignorance here but how do we remove it when the Cobertura plug-in depends on it?

image

offa commented 2 months ago

There's a new Coverage plugin, not to confuse with the Code Coverage Plugin.

captain-caveman2k commented 2 months ago

There's a new Coverage plugin, not to confuse with the Code Coverage Plugin.

Yep, I understand that and I have that installed in my Jenkins installation:

image

Unfortunately I cannot uninstall or disable Code Coverage v4.99 as Cobertura v1.17 has a dependency on it - unless there is another way of performing that. If so could you please enlighten me?

offa commented 2 months ago

With the new Coverage plugin you should be able to replace the Cobertura and (old) Coverage plugin.

captain-caveman2k commented 2 months ago

With the new Coverage plugin you should be able to replace the Cobertura and (old) Coverage plugin.

Thanks - Like others I thought the new Coverage plug-in was a replacement for the old Code Coverage plug-in rather than a replacement for both.

I have now updated my Jenkinsfile to use recordCoverage instead and uninstalled both the Cobertura plug-in and the old Code Coverage plug-in.

ddalcino commented 2 months ago

I have now updated my Jenkinsfile to use recordCoverage instead and uninstalled both the Cobertura plug-in and the old Code Coverage plug-in.

Thank you; I have done the same.

Just in case anyone is unclear on what changes are required to make Coverage work properly, I will share what I did here. I used the pipeline snippet generator for recordCoverage (go to 'Pipeline Syntax > Snippet Generator') to generate the necessary code. After modifying my Jenkinsfile accordingly, everything is working properly. Here's the diff for my Jenkinsfile:

- cobertura(coberturaReportFile: 'coverage/coverage.xml', onlyStable: false)
+ recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'coverage/coverage.xml']])

The onlyStable: false k-v pair is unnecessary for Coverage; it is automatically recording coverage for both stable and unstable builds.