feat(release): add reproducible signed artifacts (#19)
This commit is contained in:
@@ -3,6 +3,7 @@ namespace FinalFactory.Rendezvous.Server.Operations;
|
||||
internal sealed record OperatorStatusResponse
|
||||
{
|
||||
public required string Status { get; init; }
|
||||
public required OperatorCompatibilityResponse Compatibility { get; init; }
|
||||
public required OperatorReadinessResponse Readiness { get; init; }
|
||||
public required OperatorStoreResponse Store { get; init; }
|
||||
public required IReadOnlyList<OperatorTenantResponse> Tenants { get; init; }
|
||||
@@ -10,6 +11,18 @@ internal sealed record OperatorStatusResponse
|
||||
public required IReadOnlyDictionary<string, long> AuditCounts { get; init; }
|
||||
}
|
||||
|
||||
internal sealed record OperatorCompatibilityResponse
|
||||
{
|
||||
public required string ServerVersion { get; init; }
|
||||
public required string MinimumClientVersion { get; init; }
|
||||
public required int MaximumClientMajorVersion { get; init; }
|
||||
public required IReadOnlyList<int> HttpContractVersions { get; init; }
|
||||
public required IReadOnlyList<int> UdpContractVersions { get; init; }
|
||||
public required IReadOnlyList<int> ConnectionTicketFormatVersions { get; init; }
|
||||
public required int LiteNetLibMajorVersion { get; init; }
|
||||
public required string GameplayProtocolCompatibility { get; init; }
|
||||
}
|
||||
|
||||
internal sealed record OperatorReadinessResponse
|
||||
{
|
||||
public required bool HttpListener { get; init; }
|
||||
|
||||
@@ -19,6 +19,7 @@ internal sealed class OperatorService(
|
||||
return new OperatorStatusResponse
|
||||
{
|
||||
Status = readinessSnapshot.IsReady ? "ready" : "not-ready",
|
||||
Compatibility = ReleaseCompatibility.CreateResponse(),
|
||||
Readiness = new OperatorReadinessResponse
|
||||
{
|
||||
HttpListener = readinessSnapshot.HttpListenerReady,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Reflection;
|
||||
using FinalFactory.Rendezvous.Contracts;
|
||||
|
||||
namespace FinalFactory.Rendezvous.Server.Operations;
|
||||
|
||||
internal static class ReleaseCompatibility
|
||||
{
|
||||
private static readonly Assembly ServerAssembly = typeof(ReleaseCompatibility).Assembly;
|
||||
|
||||
internal static string MinimumClientVersion => Metadata("RendezvousMinimumClientVersion");
|
||||
internal static int MaximumClientMajorVersion => MetadataInteger("RendezvousMaximumClientMajorVersion");
|
||||
internal static int UdpContractVersion => MetadataInteger("RendezvousUdpContractVersion");
|
||||
internal static int ConnectionTicketFormatVersion => MetadataInteger("RendezvousConnectionTicketFormatVersion");
|
||||
internal static int LiteNetLibMajorVersion => MetadataInteger("RendezvousLiteNetLibMajorVersion");
|
||||
|
||||
internal static OperatorCompatibilityResponse CreateResponse() => new()
|
||||
{
|
||||
ServerVersion = ServerAssembly
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion.Split('+', 2)[0]
|
||||
?? ServerAssembly.GetName().Version?.ToString(3)
|
||||
?? "unknown",
|
||||
MinimumClientVersion = MinimumClientVersion,
|
||||
MaximumClientMajorVersion = MaximumClientMajorVersion,
|
||||
HttpContractVersions = [ContractLimits.ContractVersion],
|
||||
UdpContractVersions = [UdpContractVersion],
|
||||
ConnectionTicketFormatVersions = [ConnectionTicketFormatVersion],
|
||||
LiteNetLibMajorVersion = LiteNetLibMajorVersion,
|
||||
GameplayProtocolCompatibility = "exact-per-tenant",
|
||||
};
|
||||
|
||||
private static string Metadata(string key) => ServerAssembly
|
||||
.GetCustomAttributes<AssemblyMetadataAttribute>()
|
||||
.Single(attribute => string.Equals(attribute.Key, key, StringComparison.Ordinal))
|
||||
.Value
|
||||
?? throw new InvalidOperationException($"Assembly metadata {key} has no value.");
|
||||
|
||||
private static int MetadataInteger(string key) => int.Parse(
|
||||
Metadata(key),
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
Reference in New Issue
Block a user