Add pipeline status badges to all projects of a group
The debichem team on salsa.debian.org uses continuous integration (CI) pipelines and jobs to make sure the packages build and don’t ship issues. It is possible to add a badge to the projects overview page to show the status of the last run pipeline/job as shown below:
Because the team already has around 100 packages it would mean a lot of work to add a badge to each packaging project. Fortunately GitLab, the software used for salsa.debian.org, provides a way to add group badges which will appear on every projects overview page. The necessary setting can be done under the group’s settings page or the following URL
https://salsa.debian.org/groups/<GROUP>/-/edit
Expand the Badges
section as shown below:
To add the badge one has to provide a link and the corresponding badge URL. The first one should point to project’s (package’s) pipeline page:
https://salsa.debian.org/%{project_path}/pipelines
and the badge URL is:
https://salsa.debian.org/%{project_path}/badges/%{default_branch}/pipeline.svg
Using the variables provided by Gitlab might be a good idea especially if a
group is using a mixture of branch names (e.g master vs. DEP14). Hitting the
Add badge
button finally adds a badge to every project (package) under the
groups umbrella.
Below is a screenshot of these settings used in the debichem group: