fix: remove x86_64 rustflags from arm64 job cargo config - #60
Conversation
…y the source root PR #59 incorrectly added \s suffix to $(Build.SourcesDirectory), causing double-path like C:\__w\1\s\s\.cargo. The variable already points to the source root directly (C:\__w\1\s), so no subdirectory suffix needed.
There was a problem hiding this comment.
Pull request overview
Fixes the OneBranch sign-and-release pipeline paths by removing an incorrect extra \s suffix from $(Build.SourcesDirectory), ensuring Cargo config, build outputs, signing, and packaging all point at the actual repo root.
Changes:
- Write ADO
.cargo/config.tomlto$(Build.SourcesDirectory)\.cargoand update CargoAuthenticateconfigFileto.cargo/config.toml. - Update build script
workingDirectoryto$(Build.SourcesDirectory)for both x64 and arm64 jobs. - Update signing and packaging paths from
.../s/target/...and.../s/README.mdto.../target/...and.../README.md.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/sign-and-release.yml | Removes the extra \s path suffix across config writing, Cargo auth, build working directories, signing search_root, and packaging inputs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
The arm64 cross-compile job only builds aarch64-pc-windows-msvc target, so it does not need [target.x86_64-pc-windows-msvc] rustflags in its cargo config. Having x86_64 rustflags (including /CETCOMPAT) in the arm64 job's config causes CargoAuthenticate@0 to propagate them to CARGO_HOME/config.toml, which then gets merged with the arm64 config during compilation, resulting in: LNK1246: '/CETCOMPAT' not compatible with 'ARM64' target machine Note: PR #59's \s path fixes were correct and are preserved here.
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Cargo runs from $(Build.SourcesDirectory)\s but finds workspace root at $(Build.SourcesDirectory) (parent), so output goes to $(Build.SourcesDirectory)\target\... not $(Build.SourcesDirectory)\s\target\... Fix: - verify workingDirectory: remove \s suffix so relative "target\..." resolves correctly - signing search_root: remove /s/ from absolute path - package $exePath: remove /s/ from absolute path
The x64 job must use [target.x86_64-pc-windows-msvc] with /CETCOMPAT for BinSkim compliance. The arm64 job correctly uses only [target.aarch64-pc-windows-msvc] without /CETCOMPAT (which is incompatible with ARM64). Addresses Copilot review comment: restore x86_64 section for x64 job.
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (4)
.github/workflows/sign-and-release.yml:195
- signing search_root was changed to "$(Build.SourcesDirectory)/target/..." but the build runs under "$(Build.SourcesDirectory)\s" and no target-dir override is shown. This likely causes the signing task to miss the built binary; point search_root at the actual cargo output directory (typically .../s/target/...).
signing_profile: "external_distribution"
files_to_sign: "tgrep.exe"
search_root: "$(Build.SourcesDirectory)/target/x86_64-pc-windows-msvc/release"
.github/workflows/sign-and-release.yml:205
- Packaging now uses
$(Build.SourcesDirectory)/target/... for the exe while README is still taken from $ (Build.SourcesDirectory)/s/README.md. Unless cargo output is intentionally redirected to the parent directory, the exe path should likely also be under /s/target to match where cargo builds from.
$zipName = "tgrep-$tag-x86_64-pc-windows-msvc.zip"
$exePath = "$(Build.SourcesDirectory)/target/x86_64-pc-windows-msvc/release/tgrep.exe"
$readmePath = "$(Build.SourcesDirectory)/s/README.md"
.github/workflows/sign-and-release.yml:312
- Arm64 signing search_root was changed to "$(Build.SourcesDirectory)/target/..." but the build runs under "$(Build.SourcesDirectory)\s" and no target-dir override is shown. This will likely prevent the signing task from finding tgrep.exe; point search_root at the actual cargo output directory (typically .../s/target/...).
signing_profile: "external_distribution"
files_to_sign: "tgrep.exe"
search_root: "$(Build.SourcesDirectory)/target/aarch64-pc-windows-msvc/release"
.github/workflows/sign-and-release.yml:318
- Arm64 packaging now references
$(Build.SourcesDirectory)/target/... for the exe while README is still at $ (Build.SourcesDirectory)/s/README.md. Unless cargo output is intentionally redirected to the parent directory, the exe path should likely be under /s/target to match the build workingDirectory.
$zipName = "tgrep-$tag-aarch64-pc-windows-msvc.zip"
$exePath = "$(Build.SourcesDirectory)/target/aarch64-pc-windows-msvc/release/tgrep.exe"
$readmePath = "$(Build.SourcesDirectory)/s/README.md"
- Files reviewed: 1/1 changed files
- Comments generated: 3
Problem
PR #59 correctly fixed the
\spath issue (OneBranch checkout puts source at$(Build.SourcesDirectory)\s). However, build 13886498 still fails with:The linker command shows
/DYNAMICBASE /DYNAMICBASE /CETCOMPAT— two configs being merged.Root Cause
The arm64 job's cargo config included both
[target.x86_64-pc-windows-msvc]and[target.aarch64-pc-windows-msvc]sections. The x86_64 section has/CETCOMPATin its rustflags.When
CargoAuthenticate@0readss/.cargo/config.toml(which contains x86_64 rustflags with/CETCOMPAT), it writes those flags toCARGO_HOME/config.toml. Cargo then merges both configs during arm64 compilation, injecting/CETCOMPATinto the arm64 linker command — which is incompatible with ARM64.Fix
Remove the
[target.x86_64-pc-windows-msvc]section from the arm64 job's cargo config. The arm64 job only compilesaarch64-pc-windows-msvc, so it doesn't need x86_64 rustflags at all.The x86_64 job's cargo config is unchanged (it still has both x86_64 and aarch64 sections, which is fine since x86_64 job doesn't cross-compile to arm64).