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?
- Build status badges help to visually show the current build state for a pipeline in places such as readmes and dashboards.
- Easier for the developer that their latest code can be built in Build (CI) pipeline.
- To have one page view that showing all your app/service CI status.
- As your report card on your CI pipelines and boost other developer(internal or external) you have good code.
Prerequisite
- You just need to have an account of Azure DevOps
- Any Source Code Management tool like Azure DevOps(Of course), GitHub or GitLab.
- Build Status Build URL for specific branch:
Steps
- 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;
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;
You can see 2 options either using URL Image or Markdown(.md) option to show your Build (CI) pipeline build status;
2. Azure DevOps
- Repository
I have created a new Azure Repos below and it just contain README.md purposely for this tutorial;
2. Edit the .md file and put the markdown code we gathered from above step ;
3. Once we commit new code, you will see the status bad already shown in your markdown file;
3. GitHub
- Repository
I have created a new GitHub repository name azstatusbadge below and it just contain README.md ;
2. Edit README.md file and add the markdown script we get from Azure DevOps CI pipeline;
That's it!.
4. GitLab
- Repository
Finally it same with GitLab repository below and it just contain README.md;
2. Edit the README.md file and add markdown script from Azure DevOps CI pipeline;
Extra
You also can show your Azure Release/Deployment (CD) pipeline status badge, you can enable the status badge from CD options;
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 |
---|
Recap
- I've show you how to get your Azure DevOps Build (CI) pipeline status badge.
- Use CI Status Badge in Wiki page or README.md file.