Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps - During the build pipeline run, what is the path where the Agent downloads the files locally?

We are using a Microsoft Hosted Agent to run a build pipeline for an automated test scenario for our application. What we would like to achieve is, having our automation procedure, to download a file (from a headless chrome browser), then navigate to the path where it is downloaded and open it.

How could I find the path where the files are being downloaded inside the Agent?

like image 546
akakarikos Avatar asked Sep 02 '25 14:09

akakarikos


1 Answers

Quick compilation of list of pre-defined variables related to paths for the build on linux and windows self hosted agents from official doc link.

The one you are looking is Agent.BuildDirectory or Pipeline.Workspace.

List of predefined variables:

Variable type Variable Description Example
Agent Agent.BuildDirectory The local path on the agent where all folders for a given build pipeline are created D:\..\agent\_work\1
Agent Agent.HomeDirectory The directory the agent is installed into C:\agent
Agent Agent.TempDirectory A temporary folder that is cleaned after each pipeline job D:\..\agent\_work\_temp
Agent Agent.ToolsDirectory The directory used by tasks such as Node Tool Installer and Use Python Version to switch between multiple versions of a tool D:\..\agent\_work\_tool
Agent Agent.WorkFolder The working directory for agent c:\agent_work
Build Build.SourcesDirectory The local path on the agent where your source code files are downloaded. c:\agent_work\1\s
Build Build.ArtifactStagingDirectory The local path on the agent where any artifacts are copied to before being pushed to their destination. A typical way to use this folder is to publish your build artifacts with the Copy files and Publish build artifacts tasks c:\agent_work\1\a
Build Build.StagingDirectory The local path on the agent where any artifacts are copied to before being pushed to their destination. c:\agent_work\1\a
Build Build.BinariesDirectory The local path on the agent you can use as an output folder for compiled binaries c:\agent_work\1\b
Build Build.Repository.LocalPath The local path on the agent where your source code files are downloaded. c:\agent_work\1\s
Build Common.TestResultsDirectory The local path on the agent where the test results are created. c:\agent_work\1\TestResults
Pipeline Pipeline.Workspace The Workspace directory for a particular pipeline /home/vsts/work/1
System System.DefaultWorkingDirectory The local path on the agent where your source code files are downloaded. c:\agent_work\1\s
like image 120
Rajesh Swarnkar Avatar answered Sep 05 '25 14:09

Rajesh Swarnkar