TFS,工件 zip 文件名是否有变量?
TFS, is there a variable for the artifact zip file name?
有没有办法轻松获取神器文件名?看起来 TFS 已经知道这一点,如下面的日志所示:
No path specified for search pattern: *.zip defaulting to: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Searching for: *.zip under directory: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Found: 1 files to extract:
2017-12-08T16:38:36.8519067Z F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z Creating destination folder: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Extracting file: F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z [command]F:\TFS2017_Release_Agent\_work\_tasks\ExtractFiles_5e1e3830-fbfb-11e5-aab1-090c92bc4988.112.1zipz.exe x -oF:\TFS2017_Release_Agent\_work\r1\a F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8987827Z
工件不是 "a file"。在您的具体情况下,它是。但一般来说,工件可以包含任意数量的文件。
无法检索工件中存在的文件,因为工件也可以是指向 UNC 共享的指针。
对于其他人,我必须写几行来获取 zip 文件名。 ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName 是我的{神器别名}:
$zipdir = "$(System.DefaultWorkingDirectory)$(Release.Artifacts.ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName)$(Release.DefinitionName)"
Write-Host "zipfile directory: "$zipdir
$zipfile = Get-ChildItem -Filter *.zip "$zipdir"
Write-Host "zipfile : "$zipfile
有没有办法轻松获取神器文件名?看起来 TFS 已经知道这一点,如下面的日志所示:
No path specified for search pattern: *.zip defaulting to: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Searching for: *.zip under directory: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Found: 1 files to extract:
2017-12-08T16:38:36.8519067Z F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z Creating destination folder: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Extracting file: F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z [command]F:\TFS2017_Release_Agent\_work\_tasks\ExtractFiles_5e1e3830-fbfb-11e5-aab1-090c92bc4988.112.1zipz.exe x -oF:\TFS2017_Release_Agent\_work\r1\a F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8987827Z
工件不是 "a file"。在您的具体情况下,它是。但一般来说,工件可以包含任意数量的文件。
无法检索工件中存在的文件,因为工件也可以是指向 UNC 共享的指针。
对于其他人,我必须写几行来获取 zip 文件名。 ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName 是我的{神器别名}:
$zipdir = "$(System.DefaultWorkingDirectory)$(Release.Artifacts.ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName)$(Release.DefinitionName)"
Write-Host "zipfile directory: "$zipdir
$zipfile = Get-ChildItem -Filter *.zip "$zipdir"
Write-Host "zipfile : "$zipfile