fra
fra

Reputation: 3858

Associated tags in an Azure DevOps release

Is there a way to retrieve the list of tags associated to a specific release while running (e.g. within a PowerShell task)?

I searched in the predefined variables, but I could not find anything about it.

I could also get the information using the REST API, but I would like to avoid redundant work.

Upvotes: 0

Views: 489

Answers (1)

LoLance
LoLance

Reputation: 28116

For release pipeline, you can find related variables here.

I think you can use Release.Artifacts.{alias}.SourceVersion to get closest commit for your release. And then you can use some git command to get tags the commit has.

For me, I use something like this in Command Line task:

echo Get the tags.
git tag --points-at $(Release.Artifacts._GithubPermissionTest.SourceVersion

Result in log:

enter image description here

It do output the tags the commit has. And you can also do similar job in PS task.

enter image description here

Also, if you want to get tags from build instead of release, you can refer to this. Hope it helps.

Upvotes: 1

Related Questions