Is there a way to display last build id in markdown in azure devops dashboard?

Viewed 996

I was looking for the way to display badges of all build and release pipelines from the project on one dashboard and I've found that the best way to do it on one widget is to use markdown widget and just create a table with all the pipelines and corresponding badges and this works perfectly fine. This is how it looks: Markdown widget preview

This is my markdown:

    ### Applications
| App Name | Build status | UAT Deploy status | PRODUCTION Deploy Status
|:-----------:|:-----------:|:-----------:|:-----------:| 
| pipeline 1 | [![BuildStatus] (url to badge) ] (url to build pipeline) | [![Status] (url to TESTING release badge) ] (link to releases page) | [![Status] (url to LIVE release badge) ] (link to releases page)
| pipeline 2 | [![BuildStatus] (url to badge) ] (url to build pipeline) | [![Status] (url to TESTING release badge) ] (link to releases page) | [![Status] (url to LIVE release badge) ] (link to releases page)
| pipeline 3 | [![BuildStatus] (url to badge) ] (url to build pipeline) | [![Status] (url to TESTING release badge) ] (link to releases page) | [![Status] (url to LIVE release badge) ] (link to releases page)

I'm trying to add build ID in front of build status badge.

I've tried using Azure DevOps API to display Build ID similarly to how I display status badges, but it returns JSON and I'm not sure if it's possible to just display the build ID from it.

My second thought was to use Azure DevOps resources and just retrieve the value of resources.pipeline.{Alias}.runID as it's suggested in this post: Getting the latest build id from a referenced pipeline resource but unfortunately not matter what I do I can't get the value of the variable.

On 3rd attempt I've tried using html tags to run some JS to call azure devops api but html tags are displayed as text ;(

Currently I'm trying to run JS in wiki as it's capable to correctly process HTML tags, I update this post whenever I found something interesting or if I decide that there is no point to further try with wiki. So far I can't run JS in Wiki to matter how hard I try :(

My goal is to be able to display build statuses with build id, testing release statuses and live release statuses for all pipelines in any possible way it could be on widget/page whatever :)

Please keep in mind that some of the apps are containerized so build and release pipelines are not connected to each other. ( build pipeline builds image and sends it to the hub, release pipeline grabs latest image from hub and builds container from it on TESTING then from the same image it deploys container to LIVE )

3 Answers

Unfortunately after a week of researching I believe the only solution is to create custom widget which unfortunately is to much hustle in my case.

While I was researching this matter I've found nice extension called CI/CD Dashboard ( https://marketplace.visualstudio.com/items?itemName=experta.cicd-dashboard ) unfortunately because my build pipelines are not connected with release pipelines by artifact ( containers ) the extension cannot display release pipelines.

I've sent the request to Microsoft to add pipelines variables access in markdown or wiki.

example

We have a similar idea showing Build Number that can be embeded in Markdowns. I've created a proxy edge-function to do this.

  1. fetch the last build info based on some filters
  2. fetch the build badge with custom labels

Check my code here: https://github.com/darkato42/azure-repo-badge-proxy

Related