2

I have an Azure DevOps build that fails with an error that no files are found in a particular folder. If this build had run on-prem I would logon to the build server and explore the files and folder structure created by the build, in order to figure out what went wrong.

Is there a way to explore the build folder structure for a hosted agent?

Rob Bowman
  • 7,632
  • 22
  • 93
  • 200

2 Answers2

4

The Work folder is the root for all of your Pipeline tasks whether it be artifact staging, repo, copy-files etc.

Run an in-line Powershell step with the following commands:

Set-Location $env:AGENT_WORKFOLDER
Get-ChildItem -Recurse

Check out this link for some other common locations. Just search for c:\agent_work for all of the predefined variables that contain your files.

Bevan
  • 1,305
  • 1
  • 11
  • 17
1

You can add a PowerShell/Command Line task that go the agent folder and check the folders:

# Go to 's' folder in the agent - D:\a\1\s 
cd "$(Build.SourcesDirectory)"
dir

If you need deeper level you can add it of course:

cd "$(Build.SourcesDirectory)/Test/Etc"
dir

You can run the build, check the folders and if it's not enough then add more paths to check.

Or like jesse said in the comment, you can run dir /b /s to get all :)

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114