Wildcard support in docs-builder changelog bundle --input-products #2429
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.
This PR alters the "docs-builder changelog bundle" command that is added in #2341.
Impetus
The
--input-productsoption for thedocs-builder changelog bundlecommand currently performs only exact matching, which is not ideal since the target and lifecycle are not mandatory values in changelogs.Summary
Updated the
docs-builder changelog bundlecommand to require all three parts (product, target, lifecycle) when using--input-products, with wildcard support.The command now supports three filter options:
--all,--input-products, or--prs(only one at a time).Behaviour
--input-productsis used, all three parts (product, target, lifecycle) are required*)-
--input-products * * *is equivalent to--all*matches any value (including null/empty)*(e.g.,9.3.*) do prefix matchingCode Changes
src/tooling/docs-builder/Commands/ChangelogCommand.cs--all,--input-products, or--prs--input-productsis provided, validates all three parts are present (can be*)--input-products * * *to--allinternallysrc/services/Elastic.Documentation.Services/ChangelogService.cs--all,--input-products, or--prs(only one)MatchesPatternhelper function:nullpattern = wildcard (matches anything)*= prefix matchingTesting
Updated Tests (
tests/Elastic.Documentation.Services.Tests/ChangelogServiceTests.cs)BundleChangelogs_WithProductsFilter_FiltersCorrectly: Added lifecycle requirementBundleChangelogs_WithNoFilterOption_ReturnsError: Changed from "includes all" to "returns error" (filter now required)BundleChangelogs_WithMultipleFilterOptions_ReturnsError: Added lifecycle requirementNew Tests Added
BundleChangelogs_WithWildcardProductFilter_MatchesAllProducts: Tests product wildcard (*)BundleChangelogs_WithWildcardAllParts_EquivalentToAll: Tests* * *equivalent to--allBundleChangelogs_WithPrefixWildcardTarget_MatchesCorrectly: Tests prefix matching (9.3.*)Documentation Updates
docs/contribute/changelog.md--input-productsdescription to explain all three parts are required when used* * *equivalent to--allExamples
Exact Match
docs-builder changelog bundle \ --input-products "cloud-serverless 2025-12-02 ga, cloud-serverless 2025-12-06 beta"Wildcard Lifecycle
docs-builder changelog bundle \ --input-products "cloud-serverless 2025-12-02 *"Prefix Matching
docs-builder changelog bundle \ --input-products "elasticsearch 9.3.* *"Match either product, any target, any lifecycle
docs-builder changelog bundle \ --input-products "elasticsearch * *, kibana * *"Equivalent to --all
docs-builder changelog bundle \ --input-products "* * *"Validation Rules
--all,--input-products, or--prs--input-productsis used:*)*)*)Technical Details
Addendums
Returning validation errors to command line
There was also a problem where when the command returns early (e.g., return 1), the diagnostics collector isn't started, so error messages aren't displayed. The error is emitted, but the collector only displays messages after it's started and stopped. A fix commit (65a19fa) was merged to update the command to start the collector, wait for diagnostics to drain, and stop it before returning early. This ensures error messages are displayed even when validation fails early.
Now when you run:
...you should see the full error message:
Error: Multiple filter options cannot be specified together. You specified: --all, --prs. Please use only one filter option: --all, --input-products, or --prs.Adding lifecycle to bundle metadata
When using
--input-products, the products array is now extracted from the matched changelog entries, not from the filter values. So when you use--input-products "elasticsearch 9.2.0 *", the products array includes the actual lifecycle value (ga) from the changelog file, not the wildcard. In my initial tests, the lifecycle was missing from theproductsarray in the bundle, even though it existed in one of the referenced changelogs.The warning message is also now updated to include the lifecycle. For example:
Generative AI disclosure
Tool(s) and model(s) used: composer-1 agent