Skip to content

Commit ebdfcae

Browse files
authored
Add changelog render command (#2352)
1 parent e4da275 commit ebdfcae

File tree

7 files changed

+1633
-68
lines changed

7 files changed

+1633
-68
lines changed

docs/contribute/changelog.md

Lines changed: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ By adding a file for each notable change and grouping them into bundles, you can
44

55
1. Create changelogs with the `docs-builder changelog add` command.
66
2. [Create changelog bundles](#changelog-bundle) with the `docs-builder changelog bundle` command. For example, create a bundle for the pull requests that are included in a product release.
7+
3. [Create documentation](#render-changelogs) with the `docs-builder changelog render` command.
78

89
For more information about running `docs-builder`, go to [Contribute locally](https://www.elastic.co/docs/contribute-docs/locally).
910

@@ -244,88 +245,68 @@ entries:
244245
...
245246
```
246247
247-
## Examples
248+
## Create documentation [render-changelogs]
248249
249-
### Create a changelog for multiple products
250-
251-
The following command creates a changelog for a bug fix that applies to two products:
250+
The `docs-builder changelog render` command creates markdown files from changelog bundles for documentation purposes.
251+
For up-to-date details, use the `-h` command option:
252252
253253
```sh
254-
docs-builder changelog add \
255-
--title "Fixes enrich and lookup join resolution based on minimum transport version" \ <1>
256-
--type bug-fix \ <2>
257-
--products "elasticsearch 9.2.3, cloud-serverless 2025-12-02" \ <3>
258-
--areas "ES|QL"
259-
--pr "https://github.com/elastic/elasticsearch/pull/137431" <4>
260-
```
254+
Render bundled changelog(s) to markdown files
261255
262-
1. This option is required only if you want to override what's derived from the PR title.
263-
2. The type values are defined in [ChangelogConfiguration.cs](https://github.com/elastic/docs-builder/blob/main/src/services/Elastic.Documentation.Services/Changelog/ChangelogConfiguration.cs).
264-
3. The product values are defined in [products.yml](https://github.com/elastic/docs-builder/blob/main/config/products.yml).
265-
4. The `--pr` value can be a full URL (such as `https://github.com/owner/repo/pull/123`, a short format (such as `owner/repo#123`) or just a number (in which case you must also provide `--owner` and `--repo` options).
256+
Options:
257+
--input <List<BundleInput>> Required: Bundle input(s) in format "bundle-file-path, changelog-file-path, repo". Can be specified multiple times. Only bundle-file-path is required. [Required]
258+
--output <string?> Optional: Output directory for rendered markdown files. Defaults to current directory [Default: null]
259+
--title <string?> Optional: Title to use for section headers in output markdown files. Defaults to version from first bundle [Default: null]
260+
--subsections Optional: Group entries by area/component in subsections. Defaults to false
261+
```
266262
267-
The output file has the following format:
263+
Before you can use this command you must create changelog files and collect them into bundles.
264+
For example, the `docs-builder changelog bundle` command creates a file like this:
268265
269266
```yaml
270-
pr: https://github.com/elastic/elasticsearch/pull/137431
271-
type: bug-fix
272267
products:
273268
- product: elasticsearch
274-
target: 9.2.3
275-
- product: cloud-serverless
276-
target: 2025-12-02
277-
title: Fixes enrich and lookup join resolution based on minimum transport version
278-
areas:
279-
- ES|QL
269+
target: 9.2.2
270+
entries:
271+
- file:
272+
name: 1765581721-convert-bytestransportresponse-when-proxying-respo.yaml
273+
checksum: d7e74edff1bdd3e23ba4f2f88b92cf61cc7d490a
274+
- file:
275+
name: 1765581721-fix-ml-calendar-event-update-scalability-issues.yaml
276+
checksum: dfafce50c9fd61c3d8db286398f9553e67737f07
277+
- file:
278+
name: 1765581651-break-on-fielddata-when-building-global-ordinals.yaml
279+
checksum: 704b25348d6daff396259216201053334b5b3c1d
280280
```
281281
282-
### Create a changelog with PR label mappings
282+
To create markdown files from this bundle, run the `docs-builder changelog render` command:
283283
284-
You can update your changelog configuration file to contain GitHub label mappings, for example:
285-
286-
```yaml
287-
# Available areas (optional - if not specified, all areas are allowed)
288-
available_areas:
289-
- search
290-
- security
291-
- machine-learning
292-
- observability
293-
- index-management
294-
- ES|QL
295-
# Add more areas as needed
296-
297-
# GitHub label mappings (optional - used when --pr option is specified)
298-
# Maps GitHub PR labels to changelog type values
299-
# When a PR has a label that matches a key, the corresponding type value is used
300-
label_to_type:
301-
# Example mappings - customize based on your label naming conventions
302-
">enhancement": enhancement
303-
">breaking": breaking-change
304-
305-
# Maps GitHub PR labels to changelog area values
306-
# Multiple labels can map to the same area, and a single label can map to multiple areas (comma-separated)
307-
label_to_areas:
308-
# Example mappings - customize based on your label naming conventions
309-
":Search Relevance/ES|QL": "ES|QL"
284+
```sh
285+
docs-builder changelog render \
286+
--input "./changelog-bundle.yaml,./changelogs,elasticsearch" \ <1>
287+
--title 9.2.2 \ <2>
288+
--output ./release-notes \ <3>
289+
--subsections \ <4>
310290
```
311291
312-
When you use the `--pr` option to derive information from a pull request, it can make use of those mappings:
292+
1. Provide information about the changelog bundle. The format is `"<bundle-file-path>, <changelog-file-path>, <repository>"`. Only the `<bundle-file-path>` is required. The `<changelog-file-path>` is useful if the changelogs are not in the default directory and are not resolved within the bundle. The `<repository>` is useful for PR or issue link checks. You can specify `--input` multiple times to merge multiple bundles.
293+
2. The `--title` value is used for an output folder name and for section titles in the markdown files. If you omit `--title` and the first bundle contains a product `target` value, that value is used. Otherwise, if none of the bundles have product `target` fields, the title defaults to "unknown".
294+
3. By default the command creates the output files in the current directory.
295+
4. By default the changelog areas are not displayed in the output. Add `--subsections` to group changelog details by their `areas`.
313296
314-
```sh
315-
docs-builder changelog add \
316-
--pr https://github.com/elastic/elasticsearch/pull/139272 \
317-
--products "elasticsearch 9.3.0" --config test/changelog.yml
318-
```
297+
For example, the `index.md` output file contains information derived from the changelogs:
319298
320-
In this case, the changelog file derives the title, type, and areas:
299+
```md
300+
## 9.2.2 [elastic-release-notes-9.2.2]
321301
322-
```yaml
323-
pr: https://github.com/elastic/elasticsearch/pull/139272
324-
type: enhancement
325-
products:
326-
- product: elasticsearch
327-
target: 9.3.0
328-
areas:
329-
- ES|QL
330-
title: '[ES|QL] Take TOP_SNIPPETS out of snapshot'
302+
### Fixes [elastic-9.2.2-fixes]
303+
304+
**Network**
305+
* Convert BytesTransportResponse when proxying response from/to local node. [#135873](https://github.com/elastic/elastic/pull/135873)
306+
307+
**Machine Learning**
308+
* Fix ML calendar event update scalability issues. [#136886](https://github.com/elastic/elastic/pull/136886)
309+
310+
**Aggregations**
311+
* Break on FieldData when building global ordinals. [#108875](https://github.com/elastic/elastic/pull/108875)
331312
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
namespace Elastic.Documentation.Services.Changelog;
6+
7+
/// <summary>
8+
/// Input for a single bundle file with optional directory and repo
9+
/// </summary>
10+
public class BundleInput
11+
{
12+
public string BundleFile { get; set; } = string.Empty;
13+
public string? Directory { get; set; }
14+
public string? Repo { get; set; }
15+
}
16+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
namespace Elastic.Documentation.Services.Changelog;
6+
7+
/// <summary>
8+
/// Input data for rendering changelog bundle to markdown
9+
/// </summary>
10+
public class ChangelogRenderInput
11+
{
12+
public List<BundleInput> Bundles { get; set; } = [];
13+
public string? Output { get; set; }
14+
public string? Title { get; set; }
15+
public bool Subsections { get; set; }
16+
}
17+

0 commit comments

Comments
 (0)