Azure管道-是否可以查看文件夹结构? [英] Azure Pipelines - Is there a way to view the folder structure?
问题描述
我正在努力描绘天青管道的文件夹结构.我知道有一些隐式目录,例如:
- $(System.DefaultWorkingDirectory)
- $(Build.ArtifactStagingDirectory)
池中可用的特定构建代理上的两个文件夹.
是否可以查看文件夹结构并更好地了解事物的布局?
您可以使用
$(Agent.WorkFolder)
代表当前代理的工作文件夹, $(Agent.WorkFolder)\ 1
代表当前管道的工作文件夹.第一个管道将放置在 $(Agent.WorkFolder)\ 1
中,第二个管道将在 $(Agent.WorkFolder)\ 2
...)
因此很明显,对于一个管道运行,默认情况下它具有四个文件夹:a(工件文件夹),b(二进制文件夹),s(源文件夹)和TestResults(测试结果文件夹). s
文件夹是下载源代码文件的位置.对于构建管道: $(Build.SourcesDirectory)
, $(Build.Repository.LocalPath)
和 $(System.DefaultWorkingDirectory)
表示相同文件夹.有关更多详细信息,请参见预定义变量.
I'm struggling to picture the folder structure of azure pipelines. I know there are some implicit directories like:
- $(System.DefaultWorkingDirectory)
- $(Build.ArtifactStagingDirectory)
Which are both folders on a specific build agent available from the pool.
Is there a way to view the folder structure and get a better understanding how things are laid out?
You can use CMD task to call tree command in Microsoft-Hosted windows agent to get the folder structure.
My script:
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)"
The result:
$(Agent.WorkFolder)
represents the working folder for current agent, $(Agent.WorkFolder)\1
represents the working folder for current pipeline.(Normally the first pipeline will be put in $(Agent.WorkFolder)\1
, and the second $(Agent.WorkFolder)\2
...)
So it's obvious that for one pipeline run, it has four folders by default: a(artifact folder), b(binaries folder), s(source folder) and TestResults(Test results folder). The s
folder is where the source code files are downloaded. For build pipeline: $(Build.SourcesDirectory)
,$(Build.Repository.LocalPath)
and $(System.DefaultWorkingDirectory)
represent the same folder. More details see predefined variables.
这篇关于Azure管道-是否可以查看文件夹结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!