Skip to content

fix: use $(Build.SourcesDirectory)\s for OneBranch checkout path - #55

Merged
msftsiwei merged 1 commit into
mainfrom
fix/pipeline-onebranch-sources-dir
Apr 19, 2026
Merged

fix: use $(Build.SourcesDirectory)\s for OneBranch checkout path#55
msftsiwei merged 1 commit into
mainfrom
fix/pipeline-onebranch-sources-dir

Conversation

@msftsiwei

Copy link
Copy Markdown
Member

Problem

After PR #53 merged, the tgrep-win-github-release pipeline (build #13879731) failed with:

error: could not find Cargo.toml in C:\__w\1\s

Root Cause

OneBranch's checkout: self places 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.toml was written to the wrong directory
  • cargo build ran in a directory without Cargo.toml
  • Binary paths for signing/packaging were wrong

Fix

Update all $(Build.SourcesDirectory) references to $(Build.SourcesDirectory)\s:

  • $dstDir for writing .cargo/config.toml
  • configFile for CargoAuthenticate@0s/.cargo/config.toml
  • workingDirectory for cargo build and dir steps
  • search_root for signing task
  • $exePath and $readmePath for packaging

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.
Copilot AI review requested due to automatic review settings April 19, 2026 21:30
@msftsiwei
msftsiwei enabled auto-merge April 19, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)/s is 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)

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# (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)

Copilot uses AI. Check for mistakes.
@msftsiwei
msftsiwei merged commit 698c0a8 into main Apr 19, 2026
13 of 14 checks passed
@msftsiwei
msftsiwei deleted the fix/pipeline-onebranch-sources-dir branch April 19, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants