mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-05-24 06:46:26 -04:00
Sync: Upload a second manifest keyed by private commit hash (#4246)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the HEAD commit hash of the private (current) repository.
|
||||
/// </summary>
|
||||
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<string> GetCurrentLfsFiles( string relativeRepoPath )
|
||||
{
|
||||
var trackedFiles = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
|
||||
|
||||
Reference in New Issue
Block a user