Skip to content

Commit 2c9d4da

Browse files
lcawlgithub-code-quality[bot]cotti
authored
Changelog profile parity - final phases (#2808)
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
1 parent 9094f9c commit 2c9d4da

39 files changed

+1895
-923
lines changed

docs/cli/release/changelog-add.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,10 @@ docs-builder changelog add [options...] [-h|--help]
110110
: The valid types are listed in [ChangelogConfiguration.cs](https://github.com/elastic/docs-builder/blob/main/src/services/Elastic.Documentation.Services/Changelog/ChangelogConfiguration.cs).
111111

112112
`--use-pr-number`
113-
: Optional: Use the PR number(s) as the filename instead of generating it from a timestamp and title.
114-
: With multiple PRs, uses hyphen-separated numbers (for example, `137431-137432.yaml`).
115-
: Requires `--prs`. Mutually exclusive with `--use-issue-number`.
113+
: Optional: Use PR numbers for filenames instead of timestamp-slug. With both `--prs` (which creates one changelog per specified PR) and `--issues` (which creates one changelog per specified issue), each changelog filename will be derived from its PR numbers. Requires `--prs` or `--issues`. Mutually exclusive with `--use-issue-number`.
116114

117115
`--use-issue-number`
118-
: Optional: Use the issue number(s) as the filename instead of generating it from a timestamp and title.
119-
: With multiple issues, uses hyphen-separated numbers (for example, `12345-12346.yaml`).
120-
: Requires `--issues`. When both `--issues` and `--prs` are specified, still uses the issue number for the filename if this flag is set. Mutually exclusive with `--use-pr-number`.
116+
: Optional: Use issue numbers for filenames instead of timestamp-slug. With both `--prs` (which creates one changelog per specified PR) and `--issues` (which creates one changelog per specified issue), each changelog filename will be derived from its issues. Requires `--prs` or `--issues`. Mutually exclusive with `--use-pr-number`.
121117

122118
:::{important}
123119
`--use-pr-number` and `--use-issue-number` are mutually exclusive; specify only one.

docs/cli/release/changelog-bundle.md

Lines changed: 102 additions & 71 deletions
Large diffs are not rendered by default.

docs/cli/release/changelog-remove.md

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ These arguments apply to profile-based removal:
2626
`[0] <string?>`
2727
: Profile name from `bundle.profiles` in the changelog configuration file.
2828
: For example, "elasticsearch-release".
29-
: When specified, the second argument is the version or promotion report URL.
30-
: Mutually exclusive with `--all`, `--products`, `--prs`, `--issues`, `--owner`, `--repo`, `--config`, `--directory`, and `--bundles-dir`.
29+
: When specified, the second argument is the version, promotion report URL, or URL list file.
30+
: Mutually exclusive with `--all`, `--products`, `--prs`, `--issues`, `--report`, `--owner`, `--repo`, `--config`, `--directory`, and `--bundles-dir`.
3131

3232
`[1] <string?>`
33-
: Version number or promotion report URL or path.
34-
: For example, "9.2.0" or "https://buildkite.../promotion-report.html".
33+
: Version number, promotion report URL/path, or URL list file.
34+
: For example, `9.2.0`, `https://buildkite.../promotion-report.html`, or `/path/to/prs.txt`.
35+
: See [Profile argument types](/cli/release/changelog-bundle.md#profile-argument-types) for details on accepted formats.
36+
37+
`[2] <string?>`
38+
: Optional: Promotion report URL/path or URL list file when the second argument is a version string.
39+
: When provided, `[1]` must be a version string and `[2]` is the PR/issue filter source.
40+
: For example, `docs-builder changelog remove serverless-release 2026-02 ./promotion-report.html`.
3541

3642
## Options
3743

@@ -42,8 +48,8 @@ These arguments apply to profile-based removal:
4248

4349
`--bundles-dir <string?>`
4450
: Optional: Override the directory scanned for bundles during the dependency check.
45-
: When not specified, the directory is discovered automatically from config or fallback paths.
46-
: Not allowed with a profile argument. In profile mode, the bundles directory is derived from `bundle.output_directory` in the changelog configuration.
51+
: When not specified, the directory is resolved in order: `bundle.output_directory` from the changelog configuration, then `{changelog-dir}/bundles`, then `{changelog-dir}/../bundles`.
52+
: Not allowed with a profile argument. In profile mode, the same automatic discovery applies.
4753

4854
`--config <string?>`
4955
: Optional: Path to the changelog configuration file.
@@ -52,8 +58,8 @@ These arguments apply to profile-based removal:
5258

5359
`--directory <string?>`
5460
: Optional: The directory that contains the changelog YAML files.
55-
: When not specified, uses `bundle.directory` from the changelog configuration if set, otherwise the current directory.
56-
: Not allowed with a profile argument. In profile mode, the directory is derived from `bundle.directory` in the changelog configuration.
61+
: When not specified, falls back to `bundle.directory` from the changelog configuration, then the current working directory.
62+
: Not allowed with a profile argument. In profile mode, the same fallback applies (starting from `bundle.directory`).
5763

5864
`--dry-run`
5965
: Print the files that would be removed and any bundle dependency conflicts, without deleting anything.
@@ -65,9 +71,10 @@ These arguments apply to profile-based removal:
6571
: Valid in both profile and option-based mode.
6672

6773
`--issues <string[]?>`
68-
: Filter by issue URLs or numbers (comma-separated), or a path to a newline-delimited file containing issue URLs or numbers.
74+
: Filter by issue URLs (comma-separated), or a path to a newline-delimited file.
6975
: Can be specified multiple times.
70-
: Exactly one filter option must be specified: `--all`, `--products`, `--prs`, or `--issues`.
76+
: Exactly one filter option must be specified: `--all`, `--products`, `--prs`, `--issues`, or `--report`.
77+
: When using a file, every line must be a fully-qualified GitHub issue URL. Bare numbers and short forms are not allowed in files.
7178
: Not allowed with a profile argument.
7279

7380
`--owner <string?>`
@@ -87,23 +94,53 @@ These arguments apply to profile-based removal:
8794
- `"* * *"` — all changelogs (equivalent to `--all`)
8895

8996
`--prs <string[]?>`
90-
: Filter by pull request URLs or numbers (comma-separated), or a path to a newline-delimited file containing PR URLs or numbers.
97+
: Filter by pull request URLs (comma-separated), or a path to a newline-delimited file.
9198
: Can be specified multiple times.
92-
: Exactly one filter option must be specified: `--all`, `--products`, `--prs`, or `--issues`.
99+
: Exactly one filter option must be specified: `--all`, `--products`, `--prs`, `--issues`, or `--report`.
100+
: When using a file, every line must be a fully-qualified GitHub PR URL. Bare numbers and short forms are not allowed in files.
93101
: Not allowed with a profile argument.
94102

95103
`--repo <string?>`
96104
: The GitHub repository name, which is required when pull requests or issues are specified as numbers.
97105
: Not allowed with a profile argument.
98106

107+
`--report <string?>`
108+
: Filter by pull requests extracted from a promotion report. Accepts a URL or a local file path.
109+
: Exactly one filter option must be specified: `--all`, `--products`, `--prs`, `--issues`, or `--report`.
110+
: Not allowed with a profile argument.
111+
112+
## Directory resolution [changelog-remove-dirs]
113+
114+
Both modes use the same ordered fallback to locate changelog YAML files and existing bundles.
115+
116+
**Changelog files directory** (where changelog YAML files are read from):
117+
118+
| Priority | Profile-based | Option-based |
119+
|----------|---------------|--------------|
120+
| 1 | `bundle.directory` in `changelog.yml` | `--directory` CLI option |
121+
| 2 | Current working directory | `bundle.directory` in `changelog.yml` |
122+
| 3 || Current working directory |
123+
124+
**Bundles directory** (scanned for existing bundles during the dependency check):
125+
126+
| Priority | Both modes |
127+
|----------|------------|
128+
| 1 | `--bundles-dir` CLI option (option-based only) |
129+
| 2 | `bundle.output_directory` in `changelog.yml` |
130+
| 3 | `{changelog-dir}/bundles` |
131+
| 4 | `{changelog-dir}/../bundles` |
132+
133+
:::{note}
134+
"Current working directory" means the directory you are in when you run the command (`pwd`).
135+
Setting `bundle.directory` and `bundle.output_directory` in `changelog.yml` is recommended so you don't need to rely on running the command from a specific directory.
136+
:::
137+
99138
## Profile-based removal [changelog-remove-profile]
100139

101140
When a `changelog.yml` configuration file defines `bundle.profiles`, you can use those same profiles with `changelog remove` to remove exactly the changelogs that would be included in a matching bundle.
102141

103142
Profile-based commands discover the changelog configuration automatically (no `--config` flag): they look for `changelog.yml` in the current directory, then `docs/changelog.yml`. If neither file is found, the command returns an error with instructions to run `docs-builder changelog init` or to re-run from the folder where the file exists.
104143

105-
Only the `products` field from a profile is used for removal. The `output`, `output_products`, `repo`, `owner`, and `hide_features` fields are bundle-specific and are ignored.
106-
107144
For example, if your configuration file defines:
108145

109146
```yaml
@@ -122,8 +159,22 @@ docs-builder changelog remove elasticsearch-release 9.2.0 --dry-run
122159

123160
This removes changelogs for `elasticsearch 9.2.0 ga` — the same set that `docs-builder changelog bundle elasticsearch-release 9.2.0` would include.
124161

125-
You can also pass a promotion report URL or file path as the second argument, in which case the command removes changelogs whose PR URLs appear in the report:
162+
:::{note}
163+
The `output_products`, `repo`, `owner`, and `hide_features` fields are not relevant to changelog removal and are ignored.
164+
:::
165+
166+
You can also pass a promotion report URL or file path, in which case the command removes changelogs that have `prs` that match the report.
167+
The following commands perform the same task with and without a profile:
168+
169+
```sh
170+
docs-builder changelog remove serverless-report ./promotion-report.html
171+
172+
docs-builder changelog remove \
173+
--report ./promotion-report.html
174+
```
175+
176+
Alternatively, use a newline delimited text file that lists pull request or issue URLs:
126177

127178
```sh
128-
docs-builder changelog remove elasticsearch-release https://buildkite.../promotion-report.html
179+
docs-builder changelog remove serverless-report ./prs.txt
129180
```

0 commit comments

Comments
 (0)