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?
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
.
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 |
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With