Reputation: 227
In VSTS I have a release pipeline that executes a TaskGroup and this TaskGroup has different versions.
What I'm trying to do is every time the pipeline runs, get this value in my code to have a detailed log of what Version was used in each deployment. Another option could be sending it to a blob and later reading from there, but the first step is accessing the Version used in the pipeline.
This is the Version I'm refering to:
Upvotes: 1
Views: 174
Reputation: 38106
You can get the task group version which used in the release pipeline by REST API. Details as below:
Add a task get release definition REST API
Such as you can add a PowerShell task to request the REST API:
GET https://{accountName}.vsrm.visualstudio.com/{project}/_apis/release/definitions/{definitionId}?api-version=4.1-preview.3
Filter the task group from the response of the REST API and get the task group’s version
From the response of REST API, you can search the task group from workflowTasks
object, and get the task group’s version correspondingly.
As below example, the Task group: copy and publish version used in the release pipeline is 2.*
.
{
"taskId": "0bddeb71-4b7f-46b9-8264-8f2b4a1010b7",
"version": "2.*",
"name": "Task group: copy and publish ",
"refName": "",
"enabled": true,
"alwaysRun": true,
"continueOnError": true,
"timeoutInMinutes": 0,
"definitionType": "metaTask",
"overrideInputs": {},
"condition": "succeededOrFailed()",
"inputs": {}
}
Besides, you can also add an user voice to suggest to show task group's verision used in build/release pipeline.
Upvotes: 2