Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,44 +121,12 @@ public async Task<bool> Upload(IDiagnosticsCollector collector, ChangelogUploadA
if (result.Failed > 0)
collector.EmitError(string.Empty, $"{result.Failed} file(s) failed to upload");

// On a successful upload, refresh the per-product registry.json so consumers can enumerate
// content without an S3 listing: the bundle index (consumed by the changelog directive in
// cdn: mode) for bundle uploads, and the changelog-entry index (consumed by `changelog
// bundle` when sourcing entries from the CDN) for changelog uploads.
// Failures here are logged but don't fail the upload — the objects themselves are already in S3.
if (result.Failed == 0 && targets.Count > 0)
{
var scope = args.ArtifactType == ArtifactType.Bundle ? RegistryScope.Bundle : RegistryScope.Changelog;
await RefreshRegistries(collector, client, etagCalculator, args, targets, scope, ctx);
}

// No registry refresh here: the scrubber Lambda is the sole producer of the public
// registry.json, reconciled from actual public bucket state on every S3 event this upload
// just emitted (elastic/docs-eng-team#688). A private-bucket registry no longer exists.
return result.Failed == 0;
}

private async Task RefreshRegistries(
IDiagnosticsCollector collector,
IAmazonS3 client,
IS3EtagCalculator etagCalculator,
ChangelogUploadArguments args,
IReadOnlyList<UploadTarget> uploadTargets,
RegistryScope scope,
Cancel ctx)
{
try
{
var builder = new RegistryBuilder(logFactory, _fileSystem, client, etagCalculator, args.S3BucketName);
var result = await builder.RefreshAsync(collector, uploadTargets, ctx, scope);
_logger.LogInformation("Registry refresh ({Scope}): {Updated} updated, {Unchanged} unchanged, {Failed} failed",
scope, result.Updated, result.Unchanged, result.Failed);
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
// Leaving the manifest stale is non-fatal — bundle objects are unaffected.
_logger.LogWarning(ex, "Registry refresh failed; bundles uploaded successfully but manifests may be stale");
collector.EmitWarning(string.Empty, $"Failed to refresh registry manifest(s): {ex.Message}");
}
}

internal IReadOnlyList<UploadTarget> DiscoverUploadTargets(IDiagnosticsCollector collector, string changelogDir, string? org, string? repo, string? branch)
{
// Option AD: entries live once, under the authoring org/repo/branch pool — independent of which
Expand Down
343 changes: 0 additions & 343 deletions src/services/Elastic.Changelog/Uploading/RegistryBuilder.cs

This file was deleted.

Loading
Loading