up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
This commit is contained in:
@@ -2,10 +2,16 @@ using System;
|
||||
|
||||
namespace StellaOps.Scanner.Worker.Processing.Replay;
|
||||
|
||||
public sealed record ReplayBundleContext(ReplaySealedBundleMetadata Metadata, string BundlePath)
|
||||
public sealed record ReplayBundleContext
|
||||
{
|
||||
public ReplayBundleContext : this(Metadata ?? throw new ArgumentNullException(nameof(Metadata)),
|
||||
string.IsNullOrWhiteSpace(BundlePath) ? throw new ArgumentException("BundlePath required", nameof(BundlePath)) : BundlePath)
|
||||
public ReplaySealedBundleMetadata Metadata { get; }
|
||||
public string BundlePath { get; }
|
||||
|
||||
public ReplayBundleContext(ReplaySealedBundleMetadata metadata, string bundlePath)
|
||||
{
|
||||
Metadata = metadata ?? throw new ArgumentNullException(nameof(metadata));
|
||||
BundlePath = string.IsNullOrWhiteSpace(bundlePath)
|
||||
? throw new ArgumentException("BundlePath required", nameof(bundlePath))
|
||||
: bundlePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ internal sealed class SurfaceManifestStageExecutor : IScanStageExecutor
|
||||
};
|
||||
|
||||
private readonly ISurfaceManifestPublisher _publisher;
|
||||
private readonly ISurfaceManifestWriter _manifestWriter;
|
||||
private readonly ISurfaceCache _surfaceCache;
|
||||
private readonly ISurfaceEnvironment _surfaceEnvironment;
|
||||
private readonly ScannerWorkerMetrics _metrics;
|
||||
@@ -47,6 +48,7 @@ internal sealed class SurfaceManifestStageExecutor : IScanStageExecutor
|
||||
|
||||
public SurfaceManifestStageExecutor(
|
||||
ISurfaceManifestPublisher publisher,
|
||||
ISurfaceManifestWriter manifestWriter,
|
||||
ISurfaceCache surfaceCache,
|
||||
ISurfaceEnvironment surfaceEnvironment,
|
||||
ScannerWorkerMetrics metrics,
|
||||
@@ -56,6 +58,7 @@ internal sealed class SurfaceManifestStageExecutor : IScanStageExecutor
|
||||
Determinism.DeterminismContext determinism)
|
||||
{
|
||||
_publisher = publisher ?? throw new ArgumentNullException(nameof(publisher));
|
||||
_manifestWriter = manifestWriter ?? throw new ArgumentNullException(nameof(manifestWriter));
|
||||
_surfaceCache = surfaceCache ?? throw new ArgumentNullException(nameof(surfaceCache));
|
||||
_surfaceEnvironment = surfaceEnvironment ?? throw new ArgumentNullException(nameof(surfaceEnvironment));
|
||||
_metrics = metrics ?? throw new ArgumentNullException(nameof(metrics));
|
||||
@@ -112,6 +115,7 @@ internal sealed class SurfaceManifestStageExecutor : IScanStageExecutor
|
||||
var result = await _publisher.PublishAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await PersistManifestToSurfaceCacheAsync(context, tenant, result, cancellationToken).ConfigureAwait(false);
|
||||
await PersistManifestToFileStoreAsync(context, result, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
context.Analysis.Set(ScanAnalysisKeys.SurfaceManifest, result);
|
||||
stopwatch.Stop();
|
||||
@@ -403,6 +407,30 @@ internal sealed class SurfaceManifestStageExecutor : IScanStageExecutor
|
||||
result.ManifestDigest);
|
||||
}
|
||||
|
||||
private async Task PersistManifestToFileStoreAsync(
|
||||
ScanJobContext context,
|
||||
SurfaceManifestPublishResult result,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
try
|
||||
{
|
||||
var fsResult = await _manifestWriter.PublishAsync(result.Document, cancellationToken).ConfigureAwait(false);
|
||||
_logger.LogDebug(
|
||||
"Persisted surface manifest to file store for job {JobId} with URI {ManifestUri}.",
|
||||
context.JobId,
|
||||
fsResult.ManifestUri);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
ex,
|
||||
"Failed to persist surface manifest to file store for job {JobId}. File-system persistence skipped.",
|
||||
context.JobId);
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResolveImageDigest(ScanJobContext context)
|
||||
{
|
||||
static bool TryGet(IReadOnlyDictionary<string, string> metadata, string key, out string value)
|
||||
|
||||
Reference in New Issue
Block a user