Skip to content

feat(jenkins): add metric parameter support for apiv4 coverage plugin [Jenkins]#11794

Open
ashif323 wants to merge 1 commit intobadges:masterfrom
ashif323:feat/jenkins-coverage-apiv4-metrics
Open

feat(jenkins): add metric parameter support for apiv4 coverage plugin [Jenkins]#11794
ashif323 wants to merge 1 commit intobadges:masterfrom
ashif323:feat/jenkins-coverage-apiv4-metrics

Conversation

@ashif323
Copy link
Copy Markdown
Contributor

What

Closes #11689

Adds support for the new Jenkins Coverage Plugin (io.jenkins.plugins.coverage) by extending the existing apiv4 format with an optional metric query parameter.

Why

The apiv4 format previously only supported line coverage. The new Jenkins Coverage Plugin exposes multiple metrics (branch, instruction, method, module, file) that users may want to display as badges.

How

  • Added metric query parameter to queryParamSchema (valid values: line, branch, instruction, method, module, file, default: line)
  • Updated apiv4 schema to accept all metrics as optional fields
  • Updated apiv4 transform to use the selected metric
  • Updated handle method to pass metric to transform
  • Updated description to mention the new Coverage Plugin
  • Added mocked tests for default metric and branch metric

Example

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Messages
📖 ✨ Thanks for your contribution to Shields, @ashif323!

Generated by 🚫 dangerJS against 1a0c05f

@ashif323 ashif323 force-pushed the feat/jenkins-coverage-apiv4-metrics branch from 559a99d to 922c182 Compare April 10, 2026 10:27
The apiv4 format now supports a 'metric' query parameter allowing users
to choose which coverage metric to display from the new Jenkins
coverage plugin (io.jenkins.plugins.coverage).

Supported metrics: line (default), branch, instruction, method, module, file

Also updated the description to mention the new Coverage Plugin.

Closes badges#11689
@ashif323 ashif323 force-pushed the feat/jenkins-coverage-apiv4-metrics branch from 922c182 to 1a0c05f Compare April 10, 2026 10:34
@PyvesB
Copy link
Copy Markdown
Member

PyvesB commented Apr 11, 2026

Hello @ashif323 👋🏻 Do you have an example of live Jenkins job that uses the new plugin?

@PyvesB PyvesB added the service-badge New or updated service badge label Apr 11, 2026
@ashif323
Copy link
Copy Markdown
Contributor Author

Hi @PyveB 👋

I don't have a live Jenkins job available right now. Could you guide me on what would be the best way to provide a working example? I'm happy to set one up if needed to get this PR over the line!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

service-badge New or updated service badge

Development

Successfully merging this pull request may close these issues.

Please add support for the new Jenkins code-coverage plugin

2 participants