我很难想象蔚蓝管道的文件夹结构。我知道有一些隐式目录,如:
这两个文件夹都是来自池的特定生成代理上的文件夹。
是否有一种方法可以查看文件夹结构并更好地了解布局情况?
发布于 2020-07-28 07:39:17
您可以使用CMD任务在Microsoft托管的windows代理中调用树命令来获取文件夹结构。
我的脚本:
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中,第二个$(Agent.WorkFolder)\2.)
因此很明显,对于一个管道运行,默认情况下它有四个文件夹:a(工件文件夹)、b(二进制文件夹)、s(源文件夹)和TestResults(测试结果文件夹)。s文件夹是下载源代码文件的地方。对于构建管道:$(Build.SourcesDirectory)、$(Build.Repository.LocalPath)和$(System.DefaultWorkingDirectory)表示相同的文件夹。更多细节请参见预定义变量。
发布于 2020-07-30 15:00:24
另一个选项是将其添加到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.txthttps://stackoverflow.com/questions/63117797
复制相似问题