jenkinsci / badge-plugin

Jenkins Badge plugin
https://plugins.jenkins.io/badge/
MIT License
32 stars 43 forks source link

Backwards compatibility for color references #200

Closed cronik closed 1 month ago

cronik commented 1 month ago

This change improves the backwards compatibility for legacy badge color references that are not jenkins color classes. Colors that reference defined jenkins palette or semantic names are converted to their respective css variable references.

Submitter checklist

strangelookingnerd commented 1 month ago

Looking at the code I’m having a hard time to follow what is actually improved here. Would you be able to give some examples of before and after this change?

cronik commented 1 month ago

I have loads of pipelines that use color references from the jenkins palette or semantic names which used to be mapped properly to jenkins color classes.

addBadge(icon: 'symbol-star plugin-ionicons-api', color: 'yellow')

addBadge(icon: 'symbol-rocket plugin-ionicons-api', color: 'success')

The translation code fails to properly convert these colors to the variable reference so the colors look off or are not found in the case of 'success'.

strangelookingnerd commented 1 month ago

Thanks for the clarification. I was indeed unaware of this incompatibility but I guess it’s reasonable to keep the original behavior. I’ll take a closer look at the code to get this merged soon.