Skip to content

Commit 05f2c68

Browse files
authored
Merge branch 'main' into handsomely-lighter
2 parents df2a386 + c2d2a59 commit 05f2c68

21 files changed

Lines changed: 1367 additions & 1002 deletions

config/changelog.example.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,13 @@ bundle:
212212
output_directory: docs/releases
213213
# Whether to resolve (copy contents) by default
214214
resolve: true
215-
# When true, PR/issue links to repos marked private in assembler.yml are rewritten in bundle output
216-
# (requires resolve: true). Option-based: --sanitize-private-links / --no-sanitize-private-links.
217-
sanitize_private_links: false
215+
# PR/issue link allowlist: when set (including []), only links to these owner/repo pairs are kept
216+
# in bundle output; others are rewritten to '# PRIVATE:' sentinels (requires resolve: true).
217+
# When omitted, no link filtering is applied.
218+
# Add your repository and any others whose PR/issue links should appear in published docs.
219+
# link_allow_repos:
220+
# - elastic/elasticsearch
221+
# - elastic/kibana
218222
# Optional: default GitHub repo name applied to all profiles that do not specify their own.
219223
# Used by the {changelog} directive to generate correct PR/issue links when the product ID
220224
# differs from the GitHub repository name. Can be overridden per profile.
@@ -238,9 +242,6 @@ bundle:
238242
# output: "elasticsearch-{version}.yaml"
239243
# # Optional: override the products array written to the bundle output.
240244
# # output_products: "elasticsearch {version}"
241-
# # Optional: override bundle.sanitize_private_links for this profile only (requires bundle.resolve: true).
242-
# sanitize_private_links: true
243-
244245
# Example: GitHub release profile (fetches PR list directly from a GitHub release)
245246
# Use when you want to bundle or remove changelogs based on a published GitHub release.
246247
# elasticsearch-gh-release:

config/versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ versioning_systems:
33
# Updates for Stack versions are manual
44
stack: &stack
55
base: 9.0
6-
current: 9.3.2
6+
current: 9.3.3
77

88
# Using an unlikely high version
99
# So that our logic that would display "planned" doesn't trigger
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
type: feature
2-
title: Add bundle-time private link sanitization and changelog directive link visibility
2+
title: Add bundle-time link allowlist for PR and issue references
33
products:
44
- product: docs-builder
55
target: 0.100.0
@@ -9,7 +9,8 @@ areas:
99
prs:
1010
- https://github.com/elastic/docs-builder/pull/3002
1111
description: |
12-
Adds opt-in `bundle.sanitize_private_links` in changelog configuration (and per-profile override),
13-
with `--sanitize-private-links` and `--no-sanitize-private-links` on option-based changelog bundle.
14-
Rewrites PR/issue references targeting private `assembler.yml` repos to quoted `# PRIVATE` sentinels
15-
when resolve is true. The `{changelog}` directive gains `:link-visibility:` (`auto`, `keep-links`, `hide-links`).
12+
Replaces `bundle.sanitize_private_links` with explicit `bundle.link_allow_repos` (`owner/repo` list).
13+
When set (including an empty list), PR/issue references not in the allowlist are rewritten to quoted
14+
`# PRIVATE:` sentinels when the bundle is resolved. `bundle.repo` must be a single repository (no `+` syntax).
15+
Optional assembler.yml warnings when an allowlisted repo is missing or marked private.
16+
The `{changelog}` directive retains `:link-visibility:` (`auto`, `keep-links`, `hide-links`).

docs/cli/changelog/add.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,20 @@ When running inside GitHub Actions, `changelog add` automatically reads the foll
137137
| --- | --- | --- |
138138
| `CHANGELOG_PR_NUMBER` | `--prs` | `github.event.pull_request.number` |
139139
| `CHANGELOG_TITLE` | `--title` | `steps.evaluate.outputs.title` |
140+
| `CHANGELOG_DESCRIPTION` | `--description` | `steps.evaluate.outputs.description` |
140141
| `CHANGELOG_TYPE` | `--type` | `steps.evaluate.outputs.type` |
141142
| `CHANGELOG_PRODUCTS` | `--products` | `steps.evaluate.outputs.products` |
142143
| `CHANGELOG_OWNER` | `--owner` | `github.repository_owner` |
143144
| `CHANGELOG_REPO` | `--repo` | `github.event.repository.name` |
144145

145146
**Precedence**: explicit CLI arguments always take priority over environment variables. Environment variables are only used when the corresponding CLI argument is not provided.
146147

148+
`CHANGELOG_DESCRIPTION` has additional precedence rules related to release note extraction:
149+
150+
- If `--description` is provided on the command line, it always wins.
151+
- If `--no-extract-release-notes` is passed (or `extract.release_notes: false` is set in the changelog configuration), `CHANGELOG_DESCRIPTION` is ignored. This prevents a description that was extracted by `evaluate-pr` from being applied when extraction has been disabled.
152+
- Otherwise, `CHANGELOG_DESCRIPTION` fills `--description` when it is not set on the command line.
153+
147154
The filename strategy is controlled by the `filename` option in `changelog.yml` (defaulting to `timestamp`). Refer to [changelog.example.yml](https://github.com/elastic/docs-builder/blob/main/config/changelog.example.yml) for details.
148155

149156
This allows the CI action to invoke `changelog add` with a minimal command line:

docs/cli/changelog/bundle.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ The `--input-products` option determines which changelog files are gathered for
9797
: Each occurrence can be either comma-separated issues ( `--issues "https://github.com/owner/repo/issues/123,456"`) or a file path (for example `--issues /path/to/file.txt`).
9898
: When using a file, every line must be a fully-qualified GitHub issue URL such as `https://github.com/owner/repo/issues/123`. Bare numbers and short forms are not allowed in files.
9999

100-
`--no-sanitize-private-links`
101-
: Optional: Explicitly turn off the `sanitize_private_links` option if it's specified in the changelog configuration file.
102-
103100
`--no-resolve`
104101
: Optional: Explicitly turn off the `resolve` option if it's specified in the changelog configuration file.
105102

@@ -140,13 +137,6 @@ The `--input-products` option determines which changelog files are gathered for
140137
: Optional: Copy the contents of each changelog file into the entries array.
141138
: By default, the bundle contains only the file names and checksums.
142139

143-
`--sanitize-private-links`
144-
: Optional: Turn on [private link sanitization](#private-link-sanitization).
145-
: Pull requests and issues that target repositories marked `private: true` in the `references` section of `assembler.yml` are rewritten as quoted `# PRIVATE:` sentinel strings in the bundle file.
146-
: This option requires a resolved bundle: use `--resolve` or set `bundle.resolve: true` in the `changelog.yml`.
147-
: If sanitization is enabled and the bundle is not resolved, the command fails.
148-
: When you omit this option, it defaults to `bundle.sanitize_private_links` in your changelog configuration file, which defaults to `false`.
149-
150140
## Output files
151141

152142
Both modes use the same ordered fallback to determine where to write the bundle. The first value that is set wins:
@@ -284,27 +274,26 @@ rules:
284274
- "Monitoring"
285275
```
286276

287-
## Private link sanitization [private-link-sanitization]
277+
## PR and issue link allowlist [link-allowlist]
288278

289-
A changelog in a public repository might contain links to pull requests or issues in private repositories.
290-
To prevent that information from appearing in the documentation, use `bundle.sanitize_private_links` in the changelog configuration file (or a product-specific profile override) or the `--sanitize-private-links` command option.
279+
A changelog in a public repository might contain links to pull requests or issues in repositories that should not appear in published documentation.
291280

292-
This feature relies on the [`assembler.yml`](/configure/site/content.md) file and the existence of `private: true` to determine which repo links should be sanitized.
293-
Every repository that appears in a PR or issue link must be listed under `assembler.yml` `references`. References to unknown repositories fail the command so you can fix the registry.
294-
Repos are assumed to be `private: false` unless you specify otherwise.
281+
Set `bundle.link_allow_repos` in `changelog.yml` to an explicit list of `owner/repo` strings (for example, `elastic/elasticsearch`). When this key is present (including as an empty list), PR and issue references are filtered at bundle time: only links whose resolved repository is in the list are kept; others are rewritten to quoted `# PRIVATE:` sentinel strings in the bundle YAML.
295282

296283
:::{important}
297-
When you use these options, you must also set `bundle.resolve: true` or specify `--resolve`.
298-
Unresolved bundles that only store `file:` pointers do not get this rewrite; if you need private link sanitization, you must use a resolved bundle.
284+
`bundle.link_allow_repos` requires a **resolved** bundle. Set `bundle.resolve: true` or pass `--resolve`. Unresolved bundles that only store `file:` pointers are not rewritten.
299285
:::
300286

301-
The `changelog bundle`, `changelog gh-release`, and `changelog bundle-amend` commands rewrite PR and issue references that **target** private repositories into quoted sentinel strings such as `"# PRIVATE: …"` in the bundle file.
302-
The changelog directive and `changelog render` command then omit these sentinels from the documentation.
287+
When [`assembler.yml`](/configure/site/content.md) is available, docs-builder emits **warnings** (non-fatal) if an allowlisted repo is missing from `references` or is marked `private: true`, so you can verify the registry before publishing.
288+
289+
The `changelog bundle`, `changelog gh-release`, and `changelog bundle-amend` commands apply the same rules. The changelog directive and `changelog render` command omit `# PRIVATE:` sentinels from rendered documentation.
303290

304291
:::{warning}
305292
Sentinel values are omitted from rendered documentation but remain in bundle files; they are not cryptographic redaction.
306293
:::
307294

295+
`bundle.repo` must name a **single** GitHub repository (do not use `repo1+repo2` merged-repo syntax).
296+
308297
## Option-based examples
309298

310299
### Bundle by report or URL list

docs/cli/changelog/evaluate-pr.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ docs-builder changelog evaluate-pr [options...] [-h|--help]
6666
| `should-generate` | `true` if `changelog add` should run |
6767
| `should-upload` | `true` if the artifact should be uploaded |
6868
| `title` | Resolved PR title |
69+
| `description` | Release note extracted from the PR body (when `extract.release_notes` is enabled and a release note is found). Long or multi-line release notes (>120 characters) are placed here. Passed downstream as `CHANGELOG_DESCRIPTION` for `changelog add`. |
6970
| `type` | Resolved changelog type |
7071
| `products` | Comma-separated product specs resolved from PR labels via `pivot.products` mappings (e.g., `cloud-hosted, cloud-serverless`) |
7172
| `label-table` | Markdown table of configured label-to-type mappings |

docs/contribute/changelog.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,17 @@ Ideally this task will be automated such that it's performed by a bot or GitHub
363363
If you run it from the command line, you must precede any special characters (such as backquotes) with a backslash escape character (`\`).
364364
:::
365365

366+
### CI two-step flow
367+
368+
When automated via the [changelog GitHub Actions](https://github.com/elastic/docs-actions/tree/main/changelog), changelog creation is a two-step process:
369+
370+
1. **`changelog evaluate-pr`** inspects the PR (title, labels, body) and produces outputs such as `title`, `type`, `description`, and `products`.
371+
2. **`changelog add`** reads those outputs from `CHANGELOG_*` environment variables and generates the changelog YAML file.
372+
373+
The `description` output from step 1 contains the release note extracted from the PR body (when `extract.release_notes` is enabled). If extraction is disabled — either by setting `extract.release_notes: false` in `changelog.yml` or by passing `--no-extract-release-notes` to `changelog add` — the `CHANGELOG_DESCRIPTION` environment variable is ignored and the extracted description is not written to the changelog.
374+
375+
Refer to [CI auto-detection](/cli/changelog/add.md#ci-auto-detection) for the full list of environment variables and precedence rules.
376+
366377
For up-to-date command usage information, use the `-h` option or refer to [](/cli/changelog/add.md).
367378

368379
### Authorization
@@ -713,8 +724,8 @@ Top-level `bundle` fields:
713724
|---|---|
714725
| `repo` | Default GitHub repository name applied to all profiles. Falls back to product ID if not set at any level. |
715726
| `owner` | Default GitHub repository owner applied to all profiles. |
716-
| `resolve` | When `true`, embeds full changelog entry content in the bundle (same as `--resolve`). Required when `sanitize_private_links` is enabled. |
717-
| `sanitize_private_links` | When `true`, rewrites PR/issue references that target private repositories (per `assembler.yml` `references`) to quoted `# PRIVATE:` sentinel strings in bundle YAML. Requires `resolve: true` and a non-empty `references` section in `assembler.yml`. Default `false`. Refer to [Private link sanitization at bundle time](/cli/changelog/bundle.md#private-link-sanitization). |
727+
| `resolve` | When `true`, embeds full changelog entry content in the bundle (same as `--resolve`). Required when `link_allow_repos` is set. |
728+
| `link_allow_repos` | When set (including an empty list), only PR/issue links whose resolved repository is in this `owner/repo` list are kept; others are rewritten to `# PRIVATE:` sentinels in bundle YAML. When absent, no link filtering is applied. Requires `resolve: true`. Refer to [PR and issue link allowlist](/cli/changelog/bundle.md#link-allowlist). |
718729

719730
Profile configuration fields in `bundle.profiles`:
720731

@@ -727,7 +738,6 @@ Profile configuration fields in `bundle.profiles`:
727738
| `repo` | Optional. Overrides `bundle.repo` for this profile only. Required when `source: github_release` is used and no `bundle.repo` is set. |
728739
| `owner` | Optional. Overrides `bundle.owner` for this profile only. |
729740
| `hide_features` | List of feature IDs to embed in the bundle as hidden. |
730-
| `sanitize_private_links` | Optional. Overrides `bundle.sanitize_private_links` for this profile. |
731741

732742
Example profile configuration:
733743

@@ -1048,7 +1058,7 @@ The `--hide-features` option on the `render` command and the `hide-features` fie
10481058

10491059
A changelog can reference multiple pull requests and issues in the `prs` and `issues` array fields.
10501060

1051-
To comment out the private links in all changelogs in your bundles, refer to [changelog bundle](/cli/changelog/bundle.md#private-link-sanitization).
1061+
To comment out links that are not in your allowlist in all changelogs in your bundles, refer to [changelog bundle](/cli/changelog/bundle.md#link-allowlist).
10521062

10531063
If you are working in a private repo and do not want any pull request or issue links to appear (even if they target a public repo), you also have the option to configure link visibiblity in the [changelog directive](/syntax/changelog.md) and [changelog render](/cli/changelog/render.md) command.
10541064

@@ -1296,7 +1306,7 @@ docs-builder changelog remove elasticsearch-release 9.2.0 --dry-run
12961306
The command automatically discovers `changelog.yml` by checking `./changelog.yml` then `./docs/changelog.yml` relative to your current directory.
12971307
If no configuration file is found, the command returns an error with advice to create one or to run from the directory where the file exists.
12981308

1299-
The `output`, `output_products`, `hide_features`, `sanitize_private_links`, and `resolve` fields are bundle-specific and are always ignored for removal (along with other bundle-only settings that do not affect which changelog files match the filter).
1309+
The `output`, `output_products`, `hide_features`, `link_allow_repos`, and `resolve` fields are bundle-specific and are always ignored for removal (along with other bundle-only settings that do not affect which changelog files match the filter).
13001310
Which other fields are used depends on the profile type:
13011311

13021312
- Standard profiles: only the `products` field is used. The `repo` and `owner` fields are ignored (they only affect bundle output metadata).

src/Elastic.Documentation.Configuration/Changelog/BundleConfiguration.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ public record BundleConfiguration
3939
public string? Owner { get; init; }
4040

4141
/// <summary>
42-
/// When true, PR/issue references targeting repositories marked <c>private: true</c> in
43-
/// <c>assembler.yml</c> are rewritten to sentinel values at bundle time (requires <see cref="Resolve"/>).
42+
/// When set (including an empty list), PR/issue references whose resolved <c>owner/repo</c> is not listed
43+
/// are rewritten to <c># PRIVATE:</c> sentinels at bundle time. When absent, no link filtering is applied.
44+
/// Requires <see cref="Resolve"/>.
4445
/// </summary>
45-
public bool SanitizePrivateLinks { get; init; }
46+
public IReadOnlyList<string>? LinkAllowRepos { get; init; }
4647

4748
/// <summary>
4849
/// Named bundle profiles for different release scenarios.
@@ -104,9 +105,4 @@ public record BundleProfile
104105
/// Mutually exclusive with <see cref="Products"/>.
105106
/// </summary>
106107
public string? Source { get; init; }
107-
108-
/// <summary>
109-
/// When set, overrides <see cref="BundleConfiguration.SanitizePrivateLinks"/> for this profile.
110-
/// </summary>
111-
public bool? SanitizePrivateLinks { get; init; }
112108
}

0 commit comments

Comments
 (0)