VSTS Label Sources not reading Build Phase Output Variable

谁说胖子不能爱 提交于 2021-02-10 15:13:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!