Azure Pipelines Trying to Find Correct Environment Value repository checkout

what pipeline variable is this path?
i’m hunting for the environment variable for this value
i’ve tried $(Build.SourcesDirectory) and $(Agent.BuildDirectory)
these all come up in C drive, is there a source of output for all the pipeline environment variables per run?

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'

5

The value of predefined variable “Agent.BuildDirectory” is the local path on the agent where a pipeline is working in. The predefined variable “Pipeline.Workspace” also has the same value.

The “Build.SourcesDirectory” is a Azure Pipelines predefined variable, and its value is the local path on the agent where your source code files are downloaded. The predefined variables “Build.Repository.LocalPath” and “System.DefaultWorkingDirectory” also have the same value.

The “Build.SourcesDirectory” is a subdirectory under “Agent.BuildDirectory“.

For example:

There is an Windows agent named Win11-01, and its installation directory on the agent machine is “E:VstsAgentsWin11_01“, when running jobs using this agent, you might need to use the following predefined variables:

  1. Agent.WorkFolder: The working directory for this agent ( E:VstsAgentsWin11_01_work). It contains the working directories for all jobs run on this agent.

  2. Agent.BuildDirectory: The working directory for each pipeline which has jobs run on this agent ( E:VstsAgentsWin11_01_work<number>). The <number> folder will be named as 1, 2, 3, 4, etc.. which are automatically generated for each pipeline by sequential. For example, E:VstsAgentsWin11_01_work1.

  3. Pipeline.Workspace: Same as Agent.BuildDirectory.

  4. Build.SourcesDirectory: The directory where the source code files are downloaded into (E:VstsAgentsWin11_01_work<number>s). This is the default directory that the checkout task will put the downloaded files into. On the checkout task, you can use the path option to specify a different directory.

    • When you set the job to check out just one repository, the content of the repository will be directly put into this directory.
    • When you set the job to check out multiple repositories, the content of each repository will be put into the directory “E:VstsAgentsWin11_01_work<number>s<repository-name>“.
  5. Build.Repository.LocalPath and System.DefaultWorkingDirectory: Same as Build.SourcesDirectory.

For more predefined variables in Azure Pipelines, you can see the documentation “Use predefined variables“.


idk why but using NugetCommand@2 with 'restore' command on this windows agent uses back slashes . There was no error informing me of this. I changed the slashes and it started working.

despite the docs stating elsewise, see: slash documentation pipeline and seeing no contrary info in the task documentation: path variable doc in NugetCommand@2 i was left to trial and error (not really, a coworker suggested it but I dismissed the advice after reading the docs, silly me)

the code WAS in C drive despite the output of the checkout task stating elsewise. How did I find this out. I ran a recursive directory output that showed all the files.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật