Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 5.39 KB

File metadata and controls

45 lines (34 loc) · 5.39 KB
ms.topic include
ms.service azure-devops-pipelines
ms.manager mijacobs
ms.author sdanie
ms.date 01/28/2025

When pipeline jobs run on agents, a directory structure is created to store the source code, binaries, and artifacts.

The agent's home directory is the directory where the agent is installed. The directory is typically located:

  • Microsoft-hosted agents: C:\agents\<agent version> on Windows, /Users/runner/runners/<agent version> on macOS, and /home/vsts/agents/<agent version> on Linux.
  • Self-hosted agents: C:\agent on Windows, Users/<username>/agent (~/agent) on macOS, and /home/vsts/agent on Linux.

The agent's work directory contains the workspace where the source and jobs output is stored. The work directory is typically located:

  • Microsoft-hosted agent: C:\a on Windows, /Users/runner/work on macOS, and/home/vsts/work on Linux.
  • Self-hosted agent: C:\agent\_work on Windows, ~/agent/work on macOS, and /home/agent/_work on Linux.

The work directory structure is:


    - /work directory
        - /1 build directory/pipeline workspace
            - /s source/working directory
            - /b binaries directory
            - /a artifacts staging directory
            - /TestResults Test results directory
Directory Description Examples Predefined variables
Agent home directory Where the agent is installed. Microsoft-hosted agent:
   Windows: C:\agents\3.248.0
   Linux: /home/vsts/agents/3.248.0
   macOS: /Users/runner/runners/3.248.0
Self-hosted agent:
   Windows: C:\agent
   Linux: home/agent
   macOS: ~/agent
Agent.HomeDirectory
Work directory Where the agent stores the source code, binaries, and artifacts. Microsoft-hosted agent:
   Windows: C:\a
   Linux: /home/vsts/work
   macOS: /Users/runner/work
Self-hosted agent:
   Windows: C:\agent\_work
   Linux: /home/agent/_work
   macOS: ~/agent/work
Agent.WorkFolder
Agent.RootDirectory
System.WorkFolder
Build directory or workspace Where the pipeline job runs. Microsoft-hosted agent:
   Windows: C:\a\1
   Linux: /home/vsts/work/1
   macOS: /Users/runner/work/1
Self-hosted agent:
   Windows: C:\agent\_work\1
   Linux: /home/agent/_work/1
   macOS: ~/agent/work/1
Agent.BuildDirectory
Pipeline.Workspace
s - Source or working directory Contains the source code checked out from the repository. If there are multiple checkout steps in your job, your source code is checked out into directories named after the repositories as a subfolder of s. Microsoft-hosted agent:
   Windows: C:\a\1\s
   Linux: /home/vsts/work/1/s
   macOS: /Users/runner/work/1/s
Self-hosted agent:
   Windows: C:\agent\_work\1\s
   Linux: /home/agent/_work/1/s
   macOS: ~/agent/work/1/s
Build.SourcesDirectory
Build.RepositoryLocalPath
System.DefaultWorkingDirectory
b - Binaries directory Contains the build outputs. Microsoft-hosted agent:
   Windows: C:\a\1\b
   Linux: /home/vsts/work/1/b
   macOS: /Users/runner/work/1/b
Self-hosted agent:
   Windows: C:\agent\_work\1\b
   Linux: /home/agent/_work/1/b
   macOS: ~/agent/work/1/b
Build.BinariesDirectory
a - Artifacts staging directory Contains the build artifacts. Is cleaned between runs on self-hosted agents. Microsoft-hosted agent:
   Windows: C:\a\1\a
   Linux: /home/vsts/work/1/a
   macOS: /Users/runner/work/1/a
Self-hosted agent:
   Windows: C:\agent\_work\1\a
   Linux: /home/agent/_work/1/a
   macOS: ~/agent/work/1/a
Build.StagingDirectory
Build.ArtifactStagingDirectory
System.ArtifactsDirectory
TestResults directory Contains the test results. Is cleaned between runs on self-hosted agents. Microsoft-hosted agent:
   Windows: C:\a\1\TestResults
   Linux: /home/vsts/work/1/TestResults
   macOS: /Users/runner/work/1/TestResults
Self-hosted agent:
   Windows: C:\agent\_work\1\TestResults
   Linux: /home/agent/_work/1/TestResults
   macOS: ~/agent/work/1/TestResults
Common.TestResultsDirectory

On Microsoft-hosted agents, a different agent is used on each run, so the work directory isn't retained between runs. On self-hosted agents, only the artifacts staging directory and test results directories are cleaned between runs by default. For more information about the workspace clean option, see Workspace.

For more information about predefined variables, see Predefined variables.