huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

Feature request: when a build is queued, include a link or the full name of the new build #16

Closed sstamenova closed 7 years ago

sstamenova commented 7 years ago

Currently, when a new build is queued, the name of the definition is included, but nothing that uniquely identifies the queued build. If possible, we would like to be able to get a link to the new build or its full name (which in our case would include the version), so that we can identify it.

huserben commented 7 years ago

Hi

this sounds like the issue that was resolved with the latest version: https://github.com/huserben/TfsExtensions/issues/15

Under Advanced Configuration you have a checkbox that, when enabled, will store the triggered build id into an environment variable.

sstamenova commented 7 years ago

Thanks Ben, I see the ID being printed now as part of the queueing of the build and a message that they were stored in TriggeredBuildIds. However, I can't seem to be able to access that value in any way. I've tried: $(TriggeredBuildIds), %TriggeredBuildIds%, $TriggeredBuildIds, $env:TriggeredBuildIds.

What I am trying to do is rather than print out just the ID as the task does, print out a link to the newly queued build like so:

https://project.visualstudio.com/myproject/_build/index?buildId=$TriggeredBuildIds

huserben commented 7 years ago

Hi,

if you use powershell, you can use the variable like this: Write-Output "Fetching variable TriggeredBuildIds:" $variable = [Environment]::GetEnvironmentVariable("TriggeredBuildIds","User") Write-Output $($variable)

this means you could just add a new powershell task and work for example with an inline script: $variable = [Environment]::GetEnvironmentVariable("TriggeredBuildIds","User") Write-Output "https://project.visualstudio.com/myproject/_build/index?buildId=$($variable)"

sstamenova commented 7 years ago

Thanks, that works. I was able to print out the link that way. It would be great if it was also part of the task by default.

huserben commented 7 years ago

Hi

yeah i can change the output that i will not just print the id but the full link to it. The storage in the environment variable is basically if someone wants to have additional logic based on this, for example download artifacts or something.

I will change it in the next release of the task that the full link will be displayed then.

sstamenova commented 7 years ago

Thanks Ben!

huserben commented 7 years ago

Hi

I just uploaded a new version with your requested change: grafik

I will close the issue then.

Thanks for your feedback and please keep on raising issues if you find a bug or you have a change- or feature request.