Fix Windows MAX_PATH failure in Restore-RecordingsShared.ps1 (sparse-checkout + core.longpaths) - #59370
Merged
Merged
Conversation
The shared-clone restore (#59341) fails on Windows agents for packages whose recordings live at deep paths in Azure/azure-sdk-assets, because git's per-package clone+checkout hits MAX_PATH (260) on default Windows agents (LongPathsEnabled=0, no core.longpaths set). Apply Option 3 from the bug report: - Set core.longpaths=true on the shared bare clone (idempotent, applied to both freshly-initialized and reused clones). - For each per-package clone, pass -c core.longpaths=true on the clone and checkout, plus 'git config core.longpaths true' post-clone. - Configure cone-mode sparse-checkout to <AssetsRepoPrefixPath>/<DirectoryPath> before checkout so only the package's own subtree is materialized - matches test-proxy restore semantics and reduces disk/IO. - Drop the '-- .' pathspec from the final checkout so HEAD detaches to the tag cleanly with sparsity applied. Touches the README of Azure.ResourceManager.ServiceFabricManagedClusters (a canonical long-path package from the bug report) so CI exercises the deep-path restore on a Windows agent and we can verify the fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Windows CI failures in Restore-RecordingsShared.ps1 caused by deep paths in Azure/azure-sdk-assets exceeding MAX_PATH on default Windows agents, by aligning the restore strategy with test-proxy restore.
Changes:
- Adds per-package sparse-checkout targeting
<AssetsRepoPrefixPath>/<DirectoryPath>to avoid materializing the entire assets repo. - Enables
core.longpaths=trueon both the shared bare clone and per-package clones (and for key git invocations) to support long paths on Windows. - Touches
Azure.ResourceManager.ServiceFabricManagedClustersREADME to ensure CI exercises the deep-path restore scenario on Windows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| eng/scripts/Restore-RecordingsShared.ps1 | Enables core.longpaths and adds sparse-checkout to restore only the relevant recordings subtree per package. |
| sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/README.md | Adds a CI touch comment to ensure Windows CI validates the long-path restore fix. |
CI on the prior commit confirmed the Restore-RecordingsShared.ps1 fix worked on Windows agents for this deep-path package - all 5 Windows test jobs succeeded the 'Restore Recordings (shared clone)' step. Now removing the README touch so this PR only contains the actual fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JoshLove-msft
approved these changes
May 20, 2026
mcgallan
pushed a commit
to mcgallan/azure-sdk-for-net
that referenced
this pull request
Jun 11, 2026
…checkout + core.longpaths) (Azure#59370) * Fix Windows MAX_PATH failure in Restore-RecordingsShared.ps1 The shared-clone restore (Azure#59341) fails on Windows agents for packages whose recordings live at deep paths in Azure/azure-sdk-assets, because git's per-package clone+checkout hits MAX_PATH (260) on default Windows agents (LongPathsEnabled=0, no core.longpaths set). Apply Option 3 from the bug report: - Set core.longpaths=true on the shared bare clone (idempotent, applied to both freshly-initialized and reused clones). - For each per-package clone, pass -c core.longpaths=true on the clone and checkout, plus 'git config core.longpaths true' post-clone. - Configure cone-mode sparse-checkout to <AssetsRepoPrefixPath>/<DirectoryPath> before checkout so only the package's own subtree is materialized - matches test-proxy restore semantics and reduces disk/IO. - Drop the '-- .' pathspec from the final checkout so HEAD detaches to the tag cleanly with sparsity applied. Touches the README of Azure.ResourceManager.ServiceFabricManagedClusters (a canonical long-path package from the bug report) so CI exercises the deep-path restore on a Windows agent and we can verify the fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert temporary README touch on ServiceFabricManagedClusters CI on the prior commit confirmed the Restore-RecordingsShared.ps1 fix worked on Windows agents for this deep-path package - all 5 Windows test jobs succeeded the 'Restore Recordings (shared clone)' step. Now removing the README touch so this PR only contains the actual fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
eng/scripts/Restore-RecordingsShared.ps1(introduced in #59341) fails on default Windows CI agents for any package whose recordings live at a long path inAzure/azure-sdk-assets. The build stepRestore Recordings (shared clone)exits witherror: unable to create file ... Filename too longand the test job aborts before any tests run. Linux/Mac aren't affected.PR #59341 was validated against a 20-package set that didn't include any of the deep-path RM services, so the bug slipped through. Bigger test-batching matrix runs hit it: 11/50 Windows jobs failed on #58080, 24/100 on #57904.
Root cause
The script clones the assets repo per-package into
<pkg>/.assetsand runsgit checkout refs/tags/<tag> -- .. The tag tree preserves the full repo layout (net/sdk/<svc>/<pkg>/...), and on a default Windows agent (LongPathsEnabled=0, nocore.longpathsset) the resulting deep paths hit MAX_PATH (260). Test-proxy's own restore avoided this because it sparse-checks out only the package's subtree and setscore.longpathsitself.Fix (Option 3 from the bug report - both arms)
core.longpaths=true- applied to the shared bare clone (idempotent, runs on both fresh and reused clones), and to each per-package clone (post-clonegit config, plus-c core.longpaths=trueon the per-invocationcloneandcheckoutcommands so even those individual operations have it active).AssetsRepoPrefixPathfromassets.jsonandDirectoryPathfrom package info, normalise to<prefix>/<dirpath>(forward slashes, slashes trimmed, empty segments dropped), then before checkout:git -C <pkg>/.assets sparse-checkout init --conegit -C <pkg>/.assets sparse-checkout set <prefix>/<dirpath>The final checkout drops the
-- .pathspec so HEAD detaches cleanly to the tag with sparsity applied.Sparse-checkout is the structurally correct change (matches
test-proxy restoresemantics, ~10x less data on disk per package).core.longpathsis the belt-and-suspenders defence that actually unblocks deep paths.Verification
Local repro from the bug spec on a Windows box (with the fix):
Azure.ResourceManager.ServiceFabricManagedClusters(canonical long-path package): succeeds. Deepest materialised path is 278 chars, the file ends up on disk.Azure.ResourceManager.NotificationHubs: succeeds.git config).net/sdk/<that-package>/...is materialised under.assets.I could not reproduce the actual
Filename too longerror on my dev box because WindowsLongPathsEnabled=1is set in the registry there. Pre-fix I confirmed the materialised tree contains 30 files with paths > 260 chars (longest 317), which are exactly the files that fail the syscall on a default agent. The included README touch onAzure.ResourceManager.ServiceFabricManagedClustersis so CI exercises the deep-path restore on a real Windows agent and we can confirm the fix end-to-end.Related