问题
I'm trying to tag a build using the built-in, tag sources functionality of team foundation server, the tag is created during the build phase and outputted as an output variable. However the label sources step never evaluates the variable and the step fails. Why does the label sources step not evaluate the value of the tag variable ?
Tag sources has been setup like this
The Tag step creates and outputs the tag
Both the "Tag Step Logs" and the "PRINT ENV VARS" show the value of the variable that is created.
The label sources then fails as it's not able to read the tag value from the variable
回答1:
A solution to the issue has been found.
I am updating the variable Build.BuildNumber and using this in the Tag sources. This is working as this variable is available to the label sources step.
I added the following line, to update the build variable
Write-Host ("##vso[build.updatebuildnumber]$tag")
This updated number is then accessed by the label sources step using the variable
$(Build.BuildNumber)
Thanks Alexey, for figuring this out.
回答2:
That is because the Output Variable is only available in the next session, that means it only can be read from the steps which behind the step Tag variable creates
.
But as you can see, the Label source
is in the fist Get sources
step, it's before the step Tag variable creates
.
So, the Output Variable can not be read. We can not label sources with the customized variable.
We can only use the predefined and user defined variables on the variables tab to Label sources. See Label sources for details.
来源:https://stackoverflow.com/questions/50591488/vsts-label-sources-not-reading-build-phase-output-variable