简体   繁体   English

从TFS 2015获取Artifact Alias BuildNumber

[英]Get Artifact Alias BuildNumber from TFS 2015

referenced here already: How to access an artifact's BUILDNUMBER is Visual Studio Team Services Release management and here: https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/release/variables?tabs=batch 已在此处引用: 如何访问工件的BUILDNUMBER是Visual Studio Team Services发布管理 ,此处: https//docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/release/variables?tabs =批量

I am using vanilla Visual Studio Team Foundation Server 2015 (Version 14.102.25423.0) In my build I zip up an artifact with the buildnumber of the artifact. 我正在使用vanilla Visual Studio Team Foundation Server 2015(版本14.102.25423.0)在我的构建中,我使用工件的buildnumber压缩了一个工件。 eg. 例如。 20171004.16.zip I have two artifact sources defined in my release definition. 20171004.16.zip我在发布定义中定义了两个工件源。

"QA - myproject - build"
"Prod - myproject - build"

One of my steps is to copy the buildnumber.zip file to my remote server. 我的一个步骤是将buildnumber.zip文件复制到我的远程服务器。 in my configuration setting I have defined: 在我的配置设置中,我已经定义:

ProdBuildNumber = $(Release.Artifacts.Prod - myproject - build.BuildNumber)

The issue is that ProdBuildNumber just keeps getting set as that literally. 问题是ProdBuildNumber只是按字面意思设置。 eg: from debug script: 例如:来自调试脚本:

...
2017-10-05T19:09:48.0651172Z [SYSTEM] --> [release]
2017-10-05T19:09:48.0651172Z [PRODBUILDNUMBER] --> [$(Release.Artifacts.Prod - myproject - build.BuildNumber)]
2017-10-05T19:09:48.0651172Z [RELEASE_RELEASEID] --> [114]
...

Can anyone see what I am doing incorrectly? 谁能看到我做错了什么? Willing to try any ideas. 愿意尝试任何想法。

尝试

ProdBuildNumber = $(Release.Artifacts.Prod) - myproject - $(build.BuildNumber)

The [Release.Artifacts.Alias.BuildNumber] variable is not available in TFS2015. [Release.Artifacts.Alias.BuildNumber]变量在TFS2015中不可用。 Upgrade your server to TFS2017 if you want to use it and you can also check all the supported variables from the Release/Logs/Deploy. 如果要使用它,请将服务器升级到TFS2017,还可以检查Release / Logs / Deploy中支持的所有变量。 Following are the supported variables in TFS2015: 以下是TFS2015中支持的变量: 在此输入图像描述

If you cannot upgrade the server for now, you can add a powershell script task in your release definition to get the detailed artifact information via Rest API . 如果您暂时无法升级服务器,则可以在发行版定义中添加powershell脚本任务,以通过Rest API获取详细的工件信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM