Adding build badge to GitLab README.md

This may sound funny, but adding a simple build status badge (or shield if you prefer) on GitLab can be a bit tricky since it is not clearly documented.

Apparently over the time GitLab namespace scheme has changed resulting in older HOW-TOs failure. Currently you just need to add following line to your README.md (or any other markdown file you prefer):

![Build Status](https://gitlab.com/user_name/project_name/badges/branch/build.svg)

build-success

Replace user_name, project_name and branch with appropriate names. If you haven’t deleted default master branch in git, you can safely replace branch with master or any other existing branch name. To list branches in you repository just issue:

$ git branch

It is worth mentioning that GitLab is using own flavor of mark down. Check GitLab Flavored Markdown for details.

If you are using GitLab CE or EE just replace the first part of the badge url to point to your server. If for some reason you are not using DNS but IP addresses this still will work, just put IP address instead of domain name.

TIP: If you are building from more than one branch you can insert badges for every branch. This helps tracking your current status.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s