Add safe and selective backfill mode to changelog upload#3715
Open
cotti wants to merge 1 commit into
Open
Conversation
Historical backfill runs cannot rely on the live upload semantics: directory discovery can publish unrelated artifacts to the wrong scope, S3IncrementalUploader silently replaces live objects when content differs, and a failed registry refresh leaves an otherwise successful upload looking complete. changelog upload --backfill now switches the bundle upload path to backfill publishing semantics: - Explicit selection: only the files named via --files (paths or a newline-delimited path list) are uploaded; a selected file that cannot be mapped to a destination aborts before any write. - Create-only writes: bundle objects are written with a conditional PUT (If-None-Match: *). Identical remote content is skipped, different content is a conflict that never overwrites, and a concurrent create between inspection and write surfaces as a conflict via 412. The ETag pre-check is informative only. - Strict registry semantics: an unreconciled registry (S3 error or exhausted optimistic-concurrency retries) fails the operation. Conflicted objects are excluded from the refresh so the manifest never records unpublished content. Live (non-backfill) uploads keep their discovery, overwrite, and best-effort registry behavior; registries keep their concurrent conditional-update path in both modes. Part of elastic/docs-eng-team#656. Closes elastic/docs-eng-team#668
|
Label error. Requires exactly 1 of: automation, breaking, bug, changelog:skip, chore, ci, dependencies, documentation, enhancement, feature, fix, redesign. Found: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delivers the upload-path prerequisites for the release-notes backfill (items 1–3 of the epic's "Current system and prerequisites"):
changelog upload --backfillnow provides explicit file selection, create-only bundle writes, and strict registry failure semantics.ChangelogUploadService): in backfill mode the operator supplies the exact bundle YAMLs via--files(comma-separated paths or a newline-delimited path list file, aligned withchangelog bundle --files); there is no directory globbing. A selected file that cannot be mapped to a destination — missing, noproducts, invalid product — is an error that aborts the run before any write, never a silent skip.S3IncrementalUploader): a newS3WritePolicy.CreateOnlywrites bundle objects with a conditional PUT (If-None-Match: *). Identical remote content → skip (reported as such); different content → conflict, surfaced per key, never an overwrite. The ETag pre-check (existingS3EtagCalculator) is informative only — the conditional PUT is the race guard, so a concurrent create between inspection and write surfaces as a conflict (412 PreconditionFailed). There is intentionally no force flag; corrections are a separately approved workflow.Design notes
--backfillflag switches the mode, with--filesas its required selection input. The pairing is validated inChangelogUploadService(testable regardless of caller):--backfillrequires--filesand--artifact-type bundle(the backfill publishes bundles only, per the epic), and rejects--skip-etag-check, whose forced re-upload semantics would turn every idempotent re-run into a conflict.--fileswithout--backfillis rejected so live behavior cannot drift.S3WritePolicydefaults toOverwriteand the create-only path is only reachable viaargs.Backfill; without the flag, discovery, overwrite, and best-effort registry refresh are byte-for-byte the previous code paths. Registries keep their existing concurrent conditional-update path (If-Match/If-None-Match+ bounded retries) in both modes. Proven by the untouched pre-existing upload tests plus new explicit tests (Upload_DefaultPolicy_DoesNotUseConditionalPut,Upload_Live_RegistryRefreshException_DoesNotFailUpload).docs/cli-schema.jsonregenerated; supplemental docs updated (docs/cli/changelog/cmd-upload.md,docs/development/changelog-bundle-registry.md). Expected to conflict on the schema with the concurrent [Feature Request]: A way to redirect from one page to another just for specific anchors #670 PR — whoever merges second rebases and regenerates.Test plan
New tests in
Elastic.Documentation.Integrations.Tests(uploader) andElastic.Changelog.Tests(service orchestration), following the existing FakeItEasyIAmazonS3fake +MockFileSystempatterns:412) → conflict, not overwrite.--backfillwithout--files, withchangelogartifact type, or with--skip-etag-check;--fileswithout--backfill; missing selected file and productless selected bundle fail before any write.Checks run locally:
dotnet formatclean ·./build.sh build --skip-dirty-check✓ · AOT publish with zero trim/AOT warnings ✓ ·./build.sh unit-test4,247 passed / 0 failed ✓ · schema diff empty ✓.Closes elastic/docs-eng-team#668