Skip to content

Add support for CDN bundles to the changelog bundle-amend command - #3912

Open
lcawl wants to merge 1 commit into
bundle-amend-cdnfrom
parent-bundle-amend-cdn
Open

Add support for CDN bundles to the changelog bundle-amend command#3912
lcawl wants to merge 1 commit into
bundle-amend-cdnfrom
parent-bundle-amend-cdn

Conversation

@lcawl

@lcawl lcawl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Relates to #3907

Problem

The docs-builder changelog bundle-amend command currently cannot be run against a bundle that exists in the CDN.
It only works for teams that store their bundles locally in their repo.
That seems like a limitation we should fix.

Fix

changelog bundle-amend now accepts a published CDN parent and writes only the new sidecar locally. Upload stays a separate changelog upload step.

CDN parent. Locators like /bundle/kibana/9.3.0.yaml (leading slash optional, or an http(s) URL with that path) fetch bundle/{product}/registry.json, the parent YAML, and listed {parent}.amend-N.yaml sidecars — not the rest of the product catalog. Next N is max(CDN sidecars, local sidecars in the output dir) + 1. The new file is written under --output, else bundle.output_directory, else the current directory.

Local parent. Unchanged: the file must exist, siblings are scanned on disk, and the sidecar is written next to the parent. --output is ignored (with a warning).

#3911. Parent fetch uses the bundle registry (bundle/{product}/registry.json), which the scrubber already maintains. That is not the stale pool registry that PR is fixing. --add / --remove still go through the current entry FetchNamedAsync (registry-then-files on this branch). After 3911 that becomes GET-by-name with no pool listing; these new tests don’t assert pool-registry hits, so they should merge. CdnChangelogFetcher.cs will conflict with 3911’s shallow-map edits because both touch that file — the new method is additive.

@lcawl
lcawl marked this pull request as ready for review August 21, 2026 18:04
@lcawl
lcawl requested review from a team as code owners August 21, 2026 18:04
@lcawl
lcawl requested a review from theletterf August 21, 2026 18:04
if (Uri.TryCreate(trimmed, UriKind.Absolute, out var uri) && uri.Scheme is "http" or "https")
{
var path = uri.AbsolutePath.TrimStart('/');
var prefixAt = path.IndexOf(BundlePrefix, StringComparison.Ordinal);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryParseBundleLocator currently accepts any absolute URL path containing the substring bundle/. For example, (cdn.example/redacted) is treated as a valid bundle locator because IndexOf("bundle/") matches inside notbundle/. That input then proceeds as CDN-parent flow instead of being rejected.

Can we tighten this to segment-aware matching (for example path starts with bundle/ or contains /bundle/)?

/// <param name="force">Optional: When removing, match by file name even if the bundle checksum differs from the sourced changelog, or when no YAML can be sourced (inferred git-ref entries).</param>
/// <param name="forceLocal">Optional: Force local entry sourcing for this run (equivalent to <c>bundle.use_local_changelogs: true</c> without editing config).</param>
/// <param name="dryRun">Optional: Preview changes without writing an amend file.</param>
/// <param name="output">Optional: Where to write the new sidecar when the parent is a CDN locator. A directory, or a <c>.yaml</c>/<c>.yml</c> path whose file name must be <c>{parent}.amend-N.yaml</c> for the next unused N. Falls back to <c>bundle.output_directory</c> in changelog.yml, then the current directory. Ignored for a local parent.</param>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --output help text says the file name must be parent.amend-N.yaml, but runtime validation uses the parent extension (parent.amend-N plus the parent extension). For a .yml parent, users following this help text will get a validation error.

Please update this text to say the sidecar must use the same extension as the parent, or explicitly mention both .yaml and .yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant