Repository navigation
Preserve Git ownership metadata in source tarballs - #10917
Conversation
Restore direct Git archive generation and expect Git's default source archive UID and GID. Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The recursive ownership test still expects UID/GID 2001 for the source archive, which now uses 0, causing source-only validation to fail when source artifact creation is enabled.
1 open issue
What changed in this PR
Restores Git’s ownership metadata in VMR source tarballs to address release-signature mismatches, while leaving SDK, symbol, and prebuilt archive ownership normalization unchanged.
Changes:
- Generates compressed source archives directly through
git archiveandgzip -cn, removing ownership rewriting and intermediate files. - Preserves artifact naming, archive prefix, source commit, timezone, and optional empty detached signatures.
- Updates source-tarball ownership assertions to expect UID/GID
0:0.
| File | Description |
|---|---|
test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs |
Changes expected source-tarball UID/GID from 2001:2001 to 0:0. |
eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSourceArtifact.cs |
Restores direct compressed Git archive generation and removes ownership-rewriting helpers and temporary-file handling. |
Review effort: Balanced
Keep UID and GID 2001 validation for binary archives while source archives use Git's ownership metadata. Co-authored-by: Copilot App <[email protected]>
|
/backport to release/11.0.1xx |
|
/backport to release/10.0.1xx |
|
Started backporting to |
|
Started backporting to |
|
@wtgodbe backporting to git am output$ git cherry-pick 513f58934451232c589ddcb6aa372ae17e28c69f
Auto-merging test/Microsoft.DotNet.SourceBuild.Tests/SourceBuiltArtifactsTests.cs
CONFLICT (modify/delete): test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs deleted in HEAD and modified in 513f5893445 (Preserve Git ownership metadata in source tarballs (#10917)). Version 513f5893445 (Preserve Git ownership metadata in source tarballs (#10917)) of test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs left in tree.
error: could not apply 513f5893445... Preserve Git ownership metadata in source tarballs (#10917)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Preserve Git ownership metadata in source tarballs
Using index info to reconstruct a base tree...
A test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs deleted in HEAD and modified in Preserve Git ownership metadata in source tarballs. Version Preserve Git ownership metadata in source tarballs of test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Preserve Git ownership metadata in source tarballs
Error: The process '/usr/bin/git' failed with exit code 128 |
|
/backport to release/11.0.2xx |
|
Started backporting to |
|
@mthalman backporting to git am output$ git cherry-pick 513f58934451232c589ddcb6aa372ae17e28c69f
Auto-merging test/Microsoft.DotNet.SourceBuild.Tests/SourceBuiltArtifactsTests.cs
CONFLICT (content): Merge conflict in test/Microsoft.DotNet.SourceBuild.Tests/SourceBuiltArtifactsTests.cs
Auto-merging test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
CONFLICT (content): Merge conflict in test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
error: could not apply 513f5893445... Preserve Git ownership metadata in source tarballs (#10917)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Preserve Git ownership metadata in source tarballs
Using index info to reconstruct a base tree...
M eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/CreateSourceArtifact.cs
M test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
Falling back to patching base and 3-way merge...
Auto-merging test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
CONFLICT (content): Merge conflict in test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Preserve Git ownership metadata in source tarballs
Error: The process '/usr/bin/git' failed with exit code 128 |

Problem
Release signatures do not verify against GitHub-generated source tarballs because the build rewrites ownership to UID/GID
2001:2001with empty owner/group names, changing the archive bytes from Git's0:0androot:rootdefaults.Fix
Restore direct
git archivegeneration withgzip -cn, removing ownership rewriting and intermediate files. Preserve artifact naming, archive prefix, source commit, timezone, and optional empty detached signatures. Update source-tarball ownership checks to expect UID/GID0:0. SDK, symbol, and prebuilt tarball ownership normalization remains unchanged.Fixes: dotnet/source-build#5679