consolidation of some of the modules, localization fixes, product advisories work, qa work

This commit is contained in:
master
2026-03-05 03:54:22 +02:00
parent 7bafcc3eef
commit 8e1cb9448d
3878 changed files with 72600 additions and 46861 deletions

View File

@@ -7,7 +7,7 @@ using System.Text.Json.Serialization;
namespace StellaOps.Platform.Analytics.Models;
public sealed record OrchestratorEventEnvelope
public sealed record JobEngineEventEnvelope
{
[JsonPropertyName("eventId")]
public Guid EventId { get; init; }
@@ -40,13 +40,13 @@ public sealed record OrchestratorEventEnvelope
public string? TraceId { get; init; }
[JsonPropertyName("scope")]
public OrchestratorEventScope? Scope { get; init; }
public JobEngineEventScope? Scope { get; init; }
[JsonPropertyName("payload")]
public JsonElement? Payload { get; init; }
}
public sealed record OrchestratorEventScope
public sealed record JobEngineEventScope
{
[JsonPropertyName("namespace")]
public string? Namespace { get; init; }
@@ -157,7 +157,7 @@ public sealed record ScanCompletedEventPayload
public ReportReadyEventPayload? ReportReady { get; init; }
}
public static class OrchestratorEventKinds
public static class JobEngineEventKinds
{
public const string ScannerReportReady = "scanner.event.report.ready";
public const string ScannerScanCompleted = "scanner.scan.completed";

View File

@@ -30,7 +30,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
private readonly IParsedSbomParser _sbomParser;
private readonly IVulnerabilityCorrelationService? _correlationService;
private readonly ILogger<AnalyticsIngestionService> _logger;
private readonly IEventStream<OrchestratorEventEnvelope>? _eventStream;
private readonly IEventStream<JobEngineEventEnvelope>? _eventStream;
private readonly string? _scannerCheckpointFilePath;
private readonly SemaphoreSlim _scannerCheckpointLock = new(1, 1);
private readonly JsonSerializerOptions _jsonOptions = new()
@@ -58,7 +58,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
if (eventStreamFactory is not null && !string.IsNullOrWhiteSpace(_options.Streams.ScannerStream))
{
_eventStream = eventStreamFactory.Create<OrchestratorEventEnvelope>(new EventStreamOptions
_eventStream = eventStreamFactory.Create<JobEngineEventEnvelope>(new EventStreamOptions
{
StreamName = _options.Streams.ScannerStream
});
@@ -105,7 +105,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
}
}
private async Task HandleEventAsync(OrchestratorEventEnvelope envelope, CancellationToken cancellationToken)
private async Task HandleEventAsync(JobEngineEventEnvelope envelope, CancellationToken cancellationToken)
{
if (!IsSupportedScannerEventKind(envelope.Kind))
{
@@ -151,12 +151,12 @@ public sealed class AnalyticsIngestionService : BackgroundService
internal static bool IsSupportedScannerEventKind(string? eventKind)
{
return string.Equals(eventKind, OrchestratorEventKinds.ScannerReportReady, StringComparison.OrdinalIgnoreCase)
|| string.Equals(eventKind, OrchestratorEventKinds.ScannerScanCompleted, StringComparison.OrdinalIgnoreCase);
return string.Equals(eventKind, JobEngineEventKinds.ScannerReportReady, StringComparison.OrdinalIgnoreCase)
|| string.Equals(eventKind, JobEngineEventKinds.ScannerScanCompleted, StringComparison.OrdinalIgnoreCase);
}
internal static bool TryResolveScannerPayload(
OrchestratorEventEnvelope envelope,
JobEngineEventEnvelope envelope,
JsonSerializerOptions serializerOptions,
out ReportReadyEventPayload payload,
out string? error)
@@ -194,7 +194,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
return true;
}
if (!string.Equals(eventKind, OrchestratorEventKinds.ScannerScanCompleted, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(eventKind, JobEngineEventKinds.ScannerScanCompleted, StringComparison.OrdinalIgnoreCase))
{
return false;
}
@@ -506,7 +506,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
}
private async Task IngestSbomAsync(
OrchestratorEventEnvelope envelope,
JobEngineEventEnvelope envelope,
ReportReadyEventPayload payload,
CancellationToken cancellationToken)
{
@@ -767,7 +767,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
: $"sha256:{trimmed.ToLowerInvariant()}";
}
internal static string ResolveArtifactName(OrchestratorEventEnvelope envelope)
internal static string ResolveArtifactName(JobEngineEventEnvelope envelope)
{
if (!string.IsNullOrWhiteSpace(envelope.Scope?.Repo))
{
@@ -777,7 +777,7 @@ public sealed class AnalyticsIngestionService : BackgroundService
return envelope.Scope?.Image ?? envelope.Scope?.Component ?? "unknown";
}
internal static string? ResolveArtifactVersion(OrchestratorEventEnvelope envelope)
internal static string? ResolveArtifactVersion(JobEngineEventEnvelope envelope)
{
if (string.IsNullOrWhiteSpace(envelope.Scope?.Image))
{