badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.79k stars 5.5k forks source link

Badge request: Jenkins Checkstyle #6163

Open fhsevenbel opened 3 years ago

fhsevenbel commented 3 years ago

:clipboard: Description

We are currently using GitHub and Jenkins as our tools. We would like to ask if it's possible to create a badge to show the Checkstyle output we get on our Jenkins instance.

:link: Data

:microphone: Motivation

calebcartwright commented 3 years ago

Hi :wave: thanks for reaching out! Could you help us out a bit by answering some of the questions from the issue template to provide more context (e.g. what would the badge display/what information is it showing, where can that data be retrieved from)?

It's tough to answer the question about the feasibility of a badge without knowing what exactly you had in mind for the badge message, but generally speaking, if the service/tool/api makes requisite data points available then there's certainly the potential for a badge.

fhsevenbel commented 3 years ago

Hello 👋

Badge Request

We use the Gradle plugin Checkstyle and have a Jenkins plugin installed called "Warnings Next Generation". The API Endpoint is (there are xml/json endpoints, preferably json) : https://jenkinsInstanceUrl.com/job/project_name/job/branch_name/lastBuild/warnings-ng/api/json https://jenkinsInstanceUrl.com/job/project_name/job/branch_name/lastBuild/warnings-ng/api/xml

The badge should at least contain the "size" field which is the amount of checkstyle complaints. The label could be "Checkstyle".

A question

But that's not all:

We know want to know if there is a way to create a dynamic badge which will display us the data of the API endpoint AND authenticates itself. We already tried: https://shieldsInstance.com/badge/dynamic/xml?label=checkstyle&query=aggregationApi%2Ftool%2Fsize&url="URL" where "URL" = https://username:password@APIEndpointUrl.com which was working perfectly, but we do not want our username and password displayed in the URL.

*Image belongs to "Badge Request"

Checkstyle_API

chris48s commented 3 years ago

If anyone is going to work on this we need to find an example of a public jenkins project where we can call this endpoint (for dev and test purposes). There are some big public instances we use for the other jenkins badges like

calebcartwright commented 3 years ago

We know want to know if there is a way to create a dynamic badge which will display us the data of the API endpoint AND authenticates itself.

No, and I don't really see a feasible way in which that could be done given the inherent open-ended nature of the dynamic badges. If we're able to add a native jenkins checkstyle then it will be able to leverage the same jenkins creds as the other jenkins badges though