From b92a67f8e14e2d07ddbd50e0920b5e8aa0331b86 Mon Sep 17 00:00:00 2001
From: Lorenz Junglas <4759511+lolleko@users.noreply.github.com>
Date: Fri, 6 Mar 2026 13:49:11 +0100
Subject: [PATCH] Sync: Upload a second manifest keyed by private commit hash
(#4246)
---
.../Tools/SboxBuild/Steps/SyncPublicRepo.cs | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/engine/Tools/SboxBuild/Steps/SyncPublicRepo.cs b/engine/Tools/SboxBuild/Steps/SyncPublicRepo.cs
index 1ff175d2..9ea399cb 100644
--- a/engine/Tools/SboxBuild/Steps/SyncPublicRepo.cs
+++ b/engine/Tools/SboxBuild/Steps/SyncPublicRepo.cs
@@ -228,6 +228,19 @@ internal class SyncPublicRepo( string name, bool dryRun = false ) : Step( name )
return false;
}
+ // Also upload a copy of the manifest indexed by the private commit hash.
+ // This lets CI running in the private repo resolve artifacts directly from
+ // its own git history without needing to know the public commit hash.
+ var privateCommitHash = GetPrivateCommitHash();
+ if ( !string.IsNullOrEmpty( privateCommitHash ) &&
+ !string.Equals( privateCommitHash, publicCommitHash, StringComparison.OrdinalIgnoreCase ) )
+ {
+ if ( !UploadManifest( privateCommitHash, uploadedArtifacts, remoteBase ) )
+ {
+ return false;
+ }
+ }
+
var manifestTotalBytes = CalculateArtifactTotalSize( uploadedArtifacts );
Log.Info( $"Total manifest artifact size: {Utility.FormatSize( manifestTotalBytes )}" );
@@ -479,6 +492,26 @@ internal class SyncPublicRepo( string name, bool dryRun = false ) : Step( name )
return publicCommitHash;
}
+ ///
+ /// Returns the HEAD commit hash of the private (current) repository.
+ ///
+ private static string GetPrivateCommitHash()
+ {
+ string hash = null;
+ Utility.RunProcess( "git", "rev-parse HEAD", onDataReceived: ( _, e ) =>
+ {
+ if ( !string.IsNullOrWhiteSpace( e.Data ) )
+ hash ??= e.Data.Trim();
+ } );
+
+ if ( string.IsNullOrEmpty( hash ) )
+ {
+ Log.Warning( "Failed to resolve private commit hash; private-keyed manifest will not be uploaded." );
+ }
+
+ return hash;
+ }
+
private static HashSet GetCurrentLfsFiles( string relativeRepoPath )
{
var trackedFiles = new HashSet( StringComparer.OrdinalIgnoreCase );