Introducing badges for Gitlab

Have you ever tried to use more specialized badges for your private project in Gitlab?

Were you always envious of the Github projects with plenty of badges available out of the box?

What are badges?

Badges are those small images that shows information about your git project.

By default, Gitlab supports only two types of badges: Code Coverage and Pipeline Status.

Is this project for you?

Although it is possible to generate badges with other API’s such as, usually this process is not available in private repositories.

So if you are hosting a public project, this package is not specifically meant for you as you can workaround with other easier implementations.

But, if you are hosting a private project and don’t want to expose your project (Gitlab pages) or don’t want to risk exposing your credentials (API Requests), maybe this project is for you.

Another reason would be to avoid overloading servers (e.g. with unnecessary requests for (re)creating badges.

The Project

The motivation for this project was getting to know a little bit more about Python and Software Engineering.

For this I wrote a complete CI pipeline, with static tests, unit tests, documentation (read the docs) and automatic versioning and releasing to PyPi.

The steps for this will be a topic for another post.

Is this project useful?

That’s questionable, if you like some decoration to your project yes, if you don’t care about it, this is an useless project. But for me it has been quite a huge learning step of building an open source project.


The documentation is much more detailed at Read The Docs (, for this reason I will be very brief detailing the usage here.

This package was designed to run specifically as a Gitlab CI job, so the following steps should be performed to generate your static badges (snippet from .gitlab-ci.yml below):

	- pip install badges-gitlab
	- badges-gitlab
    when: always
      - public/badges/*.svg

This “badges-gitlab CLI” will perform automatically the generation of the badges assuming that you passed a token for accessing your projects API.

After you run this job, the badges will be available at the public/badges folder and can be accessed though artifacts links, e.g.:


Further reading

If you want to access the source code of the project, it is available on Gitlab

The documentation is available at:

One thought on “Introducing badges for Gitlab

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s