这条路径是什么管道变量? 我正在寻找这个值的环境变量 我已经尝试过
$(Build.SourcesDirectory)
和$(Agent.BuildDirectory)
这些都出现在C盘中,每次运行的所有管道环境变量都有输出源吗?
resources:
repositories:
- repository: self
type: git
ref: refs/heads/master
...
steps:
- checkout: self
...
- task: PowerShell@2
displayName: Display Build Dir
inputs:
targetType: 'inline'
script: 'Write-Host "Build Directory Location: `"$(Agent.BuildDirectory)`""'
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
solution: '$(BuildParameters.solution)'
selectOrConfig: config
nugetConfigPath: '$(Agent.BuildDirectory)/src/tree0/nuget.config'
预定义变量“
Agent.BuildDirectory
”的值是管道正在工作的代理上的本地路径。预定义变量“Pipeline.Workspace
”也具有相同的值。
“
Build.SourcesDirectory
”是 Azure Pipelines 预定义变量,其值是代理上下载源代码文件的本地路径。预定义变量“Build.Repository.LocalPath
”和“System.DefaultWorkingDirectory
”也具有相同的值。
“
Build.SourcesDirectory
”是“Agent.BuildDirectory
”下的子目录。
有一个名为
Win11-01
的 Windows Agent,其在 Agent 机器上的安装目录为“E:\VstsAgents\Win11_01
”,当使用此 Agent 运行作业时,您可能需要使用以下预定义变量:
Agent.WorkFolder
:此代理的工作目录 ( E:\VstsAgents\Win11_01\_work
)。它包含在此代理上运行的所有作业的工作目录。
Agent.BuildDirectory
:在此代理上运行作业的每个管道的工作目录 (E:\VstsAgents\Win11_01\_work\<number>
)。 <number>
文件夹将被命名为1
、2
、3
、4
等,按顺序为每个管道自动生成。例如,E:\VstsAgents\Win11_01\_work\1
。
Pipeline.Workspace
:与Agent.BuildDirectory
相同。
Build.SourcesDirectory
:源代码文件下载到的目录(E:\VstsAgents\Win11_01\_work\<number>\s
)。这是 checkout 任务将下载的文件放入的默认目录。在 checkout 任务中,您可以使用 path
选项指定不同的目录。
E:\VstsAgents\Win11_01\_work\<number>\s\<repository-name>
”中。有关 Azure Pipelines 中更多预定义变量,可以查看文档“使用预定义变量”。