fix: use $(Build.SourcesDirectory)\s for OneBranch checkout path - #55
Conversation
OneBranch checks out the repo into $(Build.SourcesDirectory)\s (not $(Build.SourcesDirectory) directly). Update all path references in sign-and-release.yml to use the correct subdirectory.
There was a problem hiding this comment.
Pull request overview
Updates the OneBranch ADO sign-and-release pipeline to use the correct checkout root ($(Build.SourcesDirectory)\s), fixing failures where tasks run outside the checked-out repo and can’t locate Cargo.toml or built artifacts.
Changes:
- Adjusts checkout-path assumptions in comments and updates pipeline steps to run under
$(Build.SourcesDirectory)\s. - Fixes paths for writing
.cargo/config.toml, CargoAuthenticate configFile, cargo build working directories, signing search roots, and packaging inputs for both x64 and arm64 jobs.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/sign-and-release.yml | Updates all pipeline path references to include the OneBranch \s checkout subdirectory so build/sign/package steps operate on the actual repo contents. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
.github/workflows/sign-and-release.yml:143
$(Build.SourcesDirectory)\s/$(Build.SourcesDirectory)/sis repeated in multiple steps (cargo config write, workingDirectory, signing search_root, packaging paths). To reduce the chance of future drift/missed updates, consider introducing a single variable for the checked-out repo root (e.g.,RepoRoot) and referencing it everywhere.
$dstDir = "$(Build.SourcesDirectory)\s\.cargo"
New-Item -ItemType Directory -Force -Path $dstDir | Out-Null
- Files reviewed: 1/1 changed files
- Comments generated: 1
| # - ADO pipeline is configured to use this YAML from the tgrep GitHub repo | ||
| # - ADO automatically checks out tgrep source to $(Build.SourcesDirectory) via 'checkout: self' | ||
| # - OneBranch checks out tgrep source to $(Build.SourcesDirectory)\s via 'checkout: self' | ||
| # (OneBranch convention: single-repo checkout lands in the 's' subdirectory) |
There was a problem hiding this comment.
The header comment now states the repo is checked out under $(Build.SourcesDirectory)\s, but later the (currently commented) CredScan/PoliCheck example paths still use $(Build.SourcesDirectory) without \s. Consider updating those commented examples to include \s (or otherwise clarifying the base path) so someone uncommenting them doesn’t end up pointing to non-existent paths.
This issue also appears on line 142 of the same file.
| # (OneBranch convention: single-repo checkout lands in the 's' subdirectory) | |
| # (OneBranch convention: single-repo checkout lands in the 's' subdirectory; | |
| # any repo-relative example paths below should therefore use $(Build.SourcesDirectory)\s as the base path) |
Problem
After PR #53 merged, the
tgrep-win-github-releasepipeline (build #13879731) failed with:Root Cause
OneBranch's
checkout: selfplaces the repo in$(Build.SourcesDirectory)\s(not$(Build.SourcesDirectory)directly). This is confirmed by the build timeline step name: "Checkout microsoft/tgrep@main to s".All path references in the pipeline were using
$(Build.SourcesDirectory)directly, so:.cargo/config.tomlwas written to the wrong directorycargo buildran in a directory withoutCargo.tomlFix
Update all
$(Build.SourcesDirectory)references to$(Build.SourcesDirectory)\s:$dstDirfor writing.cargo/config.tomlconfigFileforCargoAuthenticate@0→s/.cargo/config.tomlworkingDirectoryforcargo buildanddirstepssearch_rootfor signing task$exePathand$readmePathfor packaging