AzDevOps Tutorial: How To Show Your CI Pipelines Status Badges in Azure DevOps, GitHub, & GitLab

AzDevOps Tutorial: How To Show Your CI Pipelines Status Badges in Azure DevOps, GitHub, & GitLab

You can show your Azure DevOps Build (CI) Pipeline status badges in markdown (.md) file in any your public or private repository such GitHub , GitLab or Azure DevOps Overview page.

Why We Need It?

  1. Build status badges help to visually show the current build state for a pipeline in places such as readmes and dashboards.
  2. Easier for the developer that their latest code can be built in Build (CI) pipeline.
  3. To have one page view that showing all your app/service CI status.
  4. As your report card on your CI pipelines and boost other developer(internal or external) you have good code.

Prerequisite

  1. You just need to have an account of Azure DevOps
  2. Any Source Code Management tool like Azure DevOps(Of course), GitHub or GitLab.
  3. Build Status Build URL for specific branch:

Steps

  1. Get Build (CI) Status Badge:

You can get your Build (CI) status with option, you either can use Image URL below or you can directly using Markdown(.md) ;

URL Image:

GET https://dev.azure.com/{organization}/{project}/_apis/build/repos/{repoType}/badge?api-version=6.0-preview.2
'''

URL Image with optional parameters:

GET 
https://dev.azure.com/{organization}/{project}/_apis/build/repos/{repoType}/badge?repoId={repoId}&branchName={branchName}&api-version=6.0-preview.2

From CI Pipeline:

Go to your Build (CI) pipeline in Azure DevOps project and click on it;

CI-Pipeline-1

Once you in pipeline page, have the latest build  and . You have to click  click on option(3 dots) for option and see Status badge option;

go-to-status-badge

You can see 2 options either using URL Image or Markdown(.md) option to show your Build (CI) pipeline build status;

get-md-status-badge

2. Azure DevOps

  1. Repository

I have created a new Azure Repos below and it just contain README.md purposely for this tutorial;

AzRepo

2. Edit the .md file and put the markdown code we gathered from above step ;

azdevops-commit-1

3. Once we commit new code, you will see the status bad already shown in your markdown file;

azdevops-finished

3. GitHub

  1. Repository

I have created a new GitHub repository name azstatusbadge below and it just contain README.md ;

GitHub-Repo

2. Edit README.md file and add the markdown script we get from Azure DevOps CI pipeline;

github-finished

That's it!.

4. GitLab

  1. Repository

Finally it same with GitLab repository below and it just contain README.md;

GitLab

2. Edit the README.md file and add markdown script from Azure DevOps CI pipeline;

gitlab-finished

Extra

You also can show your Azure Release/Deployment (CD) pipeline status badge, you can enable the status badge from CD options;

CD-Status-badge-1

You add the URL badge into markdown file;

https://vsrm.dev.azure.com/najibradzuan/_apis/public/Release/badge/1568596a-7834-4279-acad-cbca5d49dab5/1/1
TEST
Build Status

Recap

  1. I've show you how to get your Azure DevOps Build (CI) pipeline status badge.
  2. Use CI Status Badge in Wiki page or README.md file.

Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to DevOps4Me
Great! Next, complete checkout for full access to DevOps4Me
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.