Search code examples
gitlabpipelinegitlab-cibadge

How to change pipeline badge name


As the standard pipeline badge from GitLab looks like this

enter image description here

you can tell pretty well that those are not really distinguishable.

Is there a way to change the pipeline text manually or programmatically to something else for each badge?

Btw, the badges were added with those links

https://gitlab.com/my-group/my-repository/badges/master/pipeline.svg
https://gitlab.com/my-group/my-repository/badges/dev/pipeline.svg

Additional facts:

  • The pipeline runs locally on my computer
  • My repo is private

Solution

  • I know it is a bit of an old post, but I was looking for the same and found that it is available now since GitLab 13.1.

    The text for a badge can be customized to differentiate between multiple coverage jobs that run in the same pipeline. Customize the badge text and width by adding the key_text=custom_text and key_width=custom_key_width parameters to the URL:

    https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text=Frontend+Coverage&key_width=130
    

    The example is for the Coverage badge but this also works for Pipelines, so in your case:

    https://gitlab.com/my-group/my-repository/badges/master/pipeline.svg?key_text=master&key_width=50
    https://gitlab.com/my-group/my-repository/badges/dev/pipeline.svg?key_text=dev&key_width=50
    

    (Found this via https://microfluidics.utoronto.ca/gitlab/help/ci/pipelines/settings.md#custom-badge-text)