Description
🐛 Bug Report: Dynamic Build Path Issues on Self-Hosted Windows Runner
📝 Description
When using a self-hosted Windows runner, the build paths (BUILD_PATH
and FINAL_BUILD_PATH
) are dynamically assigned based on the runner's workspace. However, inconsistencies arise due to the workspace location varying between runs, leading to failures in locating the build artifacts.
🔁 Steps to Reproduce
- Set up a self-hosted Windows runner.
- Configure a GitHub Actions workflow that builds and deploys artifacts.
- Run the workflow multiple times.
- Observe that the
BUILD_PATH
andFINAL_BUILD_PATH
change between runs, causing intermittent failures.
✅ Expected Behavior
The BUILD_PATH
and FINAL_BUILD_PATH
should consistently point to the correct locations of the build artifacts, regardless of the runner's workspace location.
🖥️ Runner Version and Platform
- Runner Version: (e.g., v2.x.x)
- Operating System: Windows Server 2022 64-bit
❌ What's Not Working?
The dynamic assignment of build paths leads to inconsistencies because the runner's workspace location can vary between runs. This variability causes the workflow to fail intermittently when it cannot locate the build artifacts.
📋 Job Log Output
Run echo "GitHub Workspace: $GITHUB_WORKSPACE"
GitHub Workspace: C:\runner\_work\my-repository\my-repository
Run Get-Location
Get-Location
Copy-Item -Path output -Destination C:\path\to\destination -Recurse -force
shell: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE -command ". '{0}'"
env:
BUILD_PATH: D:\a\my-repository\my-repository\some\obj\Release\Package\some.zip
FINAL_BUILD_PATH: Content\D_C\my-repository\my-repository\some\obj\Release\Package\PackageTmp
SH_RUNNER_WORK_LOCATION: C:\my-work-location\my-work-location
📂 Runner and Worker's Diagnostic Logs
Logs indicate variability in the runner's workspace location, leading to inconsistent path assignments:
GitHub Workspace: C:\runner\_work\my-repository\my-repository
BUILD_PATH: D:\a\my-repository\my-repository\some\obj\Release\Package\some.zip
FINAL_BUILD_PATH: Content\D_C\my-repository\my-repository\some\obj\Release\Package\PackageTmp
SH_RUNNER_WORK_LOCATION: C:\my-work-location\my-work-location
Additional Information
The main issue observed is that the BUILD_PATH
and FINAL_BUILD_PATH
sometimes resolve to paths on the C:
drive, while other times they resolve to paths on the D:
drive. This inconsistency causes the build process to intermittently fail, as the paths to the build artifacts are not always the same.
Example 1:
BUILD_PATH
:C:\a\my-repository\my-repository\some\obj\Release\Package\some.zip
FINAL_BUILD_PATH
:Content\C_C\my-repository\my-repository\some\obj\Release\Package\PackageTmp
Example 2:
BUILD_PATH
:D:\a\my-repository\my-repository\some\obj\Release\Package\some.zip
FINAL_BUILD_PATH
:Content\D_C\my-repository\my-repository\some\obj\Release\Package\PackageTmp
This issue has been observed in self-hosted Windows runners, where path inconsistencies arise due to varying workspace locations.