DEV Community

Cover image for What are GitLab badges?
Benjamin Rancourt
Benjamin Rancourt

Posted on • Originally published at benjaminrancourt.ca on

What are GitLab badges?

In one of my previous posts, Introduction to badges, I (obviously) introduce you to the concept of repositories badges, but did you know that GitLab offers a similar concept named GitLab badges?

Unlike normal badges, these appear at the top of the project overview detail page, just below the repository’s description.

Header of a repository with GitLab badges

They are defined by repository configuration , in SettingsGeneralBadges.

Screenshot of the Badges configuration in a GitLab repository

Unlike normal badges, where only the image URL was mandatory, GitLab badges also require a link. In the case where a link does not make any sense, you can put the repository URL to satisfy this constraint. 🔗

Group badges

If your projects are all under a group, you can also specify group badges that will be inherited by all projects. If your organization has an inheritance of groups, the real value of group badges will be revealed, as you can apply a badge to all repositories recursively. You will not need anymore to edit a dozen repositories to add the same badge!

You may have some badges that can be applied to all projects, or you can also specify some general badge, like one of my favourites: Pipeline status.

Pipeline status badge

If your projects use GitLab CI, you can quickly add a badge to display the status of the latest pipeline. By using placeholders , the badges will even be computed by GitLab correctly for each of your projects.

By using these settings, you will not see an image on your group badges, but, if you navigate to a repository of the same group, all the badge properties will be computed correctly and you will be able to see the badge.

If you click on it, you will be sent to the Pipelines page, where you will be able to see the latest pipeline for your default branch. 🎉

A group badge with placeholders, seen on a group

The same group badge, seen on a repository of the same group

Conclusion

If you prefer to define your badges by editing the README.md file, you still can, but they will not appear at the top of the repository. So, you now have two ways to define your repository badges. 🤠

What do you think of GitLab badges?

Top comments (0)