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 shields.io, 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. shields.io) with unnecessary requests for (re)creating badges.
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 (badges-gitlab.readthedocs.io), 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):
variables: PRIVATE_TOKEN: $ACCESS_TOKEN script: - pip install badges-gitlab - badges-gitlab artifacts: when: always paths: - 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.:
If you want to access the source code of the project, it is available on Gitlab
The documentation is available at: