Add support for CDN bundles to the changelog bundle-amend command - #3912
Add support for CDN bundles to the changelog bundle-amend command#3912lcawl wants to merge 1 commit into
Conversation
| 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); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
Relates to #3907
Problem
The
docs-builder changelog bundle-amendcommand 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-amendnow accepts a published CDN parent and writes only the new sidecar locally. Upload stays a separatechangelog uploadstep.CDN parent. Locators like
/bundle/kibana/9.3.0.yaml(leading slash optional, or anhttp(s)URL with that path) fetchbundle/{product}/registry.json, the parent YAML, and listed{parent}.amend-N.yamlsidecars — not the rest of the product catalog. NextNismax(CDN sidecars, local sidecars in the output dir) + 1. The new file is written under--output, elsebundle.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.
--outputis 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/--removestill go through the current entryFetchNamedAsync(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.cswill conflict with 3911’s shallow-map edits because both touch that file — the new method is additive.