我正在努力描绘天青管道的文件夹结构。我知道有一些隐式目录,例如:
池中可用的特定构建代理上的两个文件夹。
是否可以查看文件夹结构并更好地了解事物的布局?
答案 0 :(得分:3)
您可以使用CMD task在Microsoft托管的Windows代理中调用tree command来获取文件夹结构。
我的脚本:
echo "Structure of work folder of this pipeline:"
tree $(Agent.WorkFolder)\1 /f
echo "Build.ArtifactStagingDirectory:"
echo "$(Build.ArtifactStagingDirectory)"
echo "Build.BinariesDirectory:"
echo "$(Build.BinariesDirectory)"
echo "Build.SourcesDirectory:"
echo "$(Build.SourcesDirectory)"
结果:
$(Agent.WorkFolder)
代表当前代理的工作文件夹,$(Agent.WorkFolder)\1
代表当前管道的工作文件夹。(通常,第一个管道将放置在$(Agent.WorkFolder)\1
中,第二个{{1 }} ...)
因此很明显,对于一个管道运行,默认情况下它具有四个文件夹:a(工件文件夹),b(二进制文件夹),s(源文件夹)和TestResults(测试结果文件夹)。 $(Agent.WorkFolder)\2
文件夹是下载源代码文件的位置。对于构建管道:s
,$(Build.SourcesDirectory)
和$(Build.Repository.LocalPath)
代表相同的文件夹。有关更多详细信息,请参见predefined variables。
答案 1 :(得分:1)
文档为您提供了文件夹结构的示例。如果这还不够,请添加运行gci -rec -directory | select-object fullname
或类似程序的PowerShell步骤。
答案 2 :(得分:1)
另一个选择是将其添加到YAML管道中:
-powershell: Get-ChildItem -Path 'Insert root path' -recurse
它看起来像:
Get-ChildItem -Path C:\Test\*.txt -Recurse -Force
Directory: C:\Test\Logs\Adirectory
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/12/2019 16:16 20 Afile4.txt
-a-h-- 2/12/2019 15:52 22 hiddenfile.txt
-a---- 2/13/2019 13:26 20 LogFile4.txt
Directory: C:\Test\Logs\Backup
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/12/2019 16:16 20 ATextFile.txt
-a---- 2/12/2019 15:50 20 LogFile3.txt
Directory: C:\Test\Logs
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/12/2019 16:16 20 Afile.txt
-a-h-- 2/12/2019 15:52 22 hiddenfile.txt
-a---- 2/13/2019 13:26 20 LogFile1.txt
Directory: C:\Test
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/13/2019 08:55 26 anotherfile.txt
-a---- 2/12/2019 15:40 118014 Command.txt
-a-h-- 2/12/2019 15:52 22 hiddenfile.txt
-ar--- 2/12/2019 14:31 27 ReadOnlyFile.txt
这里是documentation on the Get-ChildItem command if you need more information
答案 3 :(得分:0)