@redpanda-data/docs-extensions-and-macros 3.3.2 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.adoc CHANGED
@@ -44,13 +44,13 @@ To use the development version instead, refer to the <<development-quickstart,De
44
44
 
45
45
  This section documents the Antora extensions that are provided by this library and how to configure them.
46
46
 
47
- IMPORTANT: Be sure to register each extension under the `antora.extensions` key in the playbook, not the `asciidoc.extensions` key.
47
+ IMPORTANT: Ensure you register each extension under the `antora.extensions` key in the playbook, not the `asciidoc.extensions` key.
48
48
 
49
49
  === Algolia indexer
50
50
 
51
51
  This extension generates an Algolia index for each version of each component. The index entries are then saved to Algolia using the `saveObjects()` method, and also saved as JSON files in the site catalog. JSON files are published to the site root using the following template: `algolia-<component>-<version>.json`.
52
52
 
53
- NOTE: Only pages that include an `<article>` element with the `doc` class are indexed. Pages marked as "noindex" for "robots" are skipped.
53
+ NOTE: Only pages that include an `<article>` element with the `doc` class are indexed.
54
54
 
55
55
  ==== Environment variables
56
56
 
@@ -85,6 +85,14 @@ This extension maps Redpanda Connect component data into a structured format:
85
85
  - Populates `connectCategoriesData` and `flatComponentsData` attributes.
86
86
  - Skips deprecated components.
87
87
 
88
+ ==== Environment variables
89
+
90
+ This extension does not require any environment variables.
91
+
92
+ ==== Configuration options
93
+
94
+ There are no configurable options for this extension.
95
+
88
96
  ==== Registration Example
89
97
 
90
98
  ```yaml
@@ -93,19 +101,41 @@ antora:
93
101
  - require: '@redpanda-data/docs-extensions-and-macros/extensions/generate-rp-connect-categories'
94
102
  ```
95
103
 
104
+ === Redpanda Connect tag modifier
105
+
106
+ This extension updates the playbook to use the latest release tag for the Redpanda Connect documentation. It ensures that the Redpanda Connect documentation is always pulled from the latest release tag available on GitHub.
107
+
108
+ ==== Environment variables
109
+
110
+ - `REDPANDA_GITHUB_TOKEN` (optional): A Personal access token (PAT) that has `repo` permissions for the `redpanda-data` GitHub organization.
111
+
112
+ NOTE: If you don't set the environment variable, the latest version of Redpanda Connect may not be fetched. When the environment variable is not set, the extension sends unauthenticated requests to GitHub. Unauthenticated requests may result in hitting the API rate limit and cause GitHub to reject the request. In this case the fallback version is used. This version is defined in the playbook where the extension is registered.
113
+
114
+ ==== Configuration options
115
+
116
+ There are no configurable options for this extension.
117
+
118
+ ==== Registration Example
119
+
120
+ ```yaml
121
+ antora:
122
+ extensions:
123
+ - require: '@redpanda-data/docs-extensions-and-macros/extensions/modify-connect-tag-playbook'
124
+ ```
125
+
96
126
  === Version fetcher
97
127
 
98
128
  This extension fetches the latest release versions from GitHub.
99
129
 
100
- The latest Console version is made available to all versions of the Redpanda docs (`ROOT` component.)
130
+ The latest versions of Redpanda Console and Redpanda Connect are made available to all versions of all Antora components.
101
131
 
102
- The latest Redpanda version and the latest Redpanda Operator version is made available to the latest version of the `ROOT` component.
132
+ The latest Redpanda version and the latest Redpanda Operator version are made available to the latest version of the `ROOT` component (Redpanda docs).
103
133
 
104
134
  ==== Environment variables
105
135
 
106
136
  - `REDPANDA_GITHUB_TOKEN` (optional): A Personal access token (PAT) that has `repo` permissions for the `redpanda-data` GitHub organization.
107
137
 
108
- NOTE: If you don't set the environment variable, the latest versions may not be made available to your build. When the environment variable is not set, the extension sends unauthenticated requests to GitHub. Unauthenticated requests may result in hitting the API rate limit and cause GitHub to reject the request.
138
+ NOTE: If you don't set the environment variable, the latest versions may not be fetched. When the environment variable is not set, the extension sends unauthenticated requests to GitHub. Unauthenticated requests may result in hitting the API rate limit and cause GitHub to reject the request.
109
139
 
110
140
  ==== Registration example
111
141
 
@@ -188,6 +218,14 @@ antora:
188
218
 
189
219
  This extension collects Asciidoc attributes from the {url-playbook}[`shared` component] and makes them available to all component versions. Having global attributes is useful for consistent configuration of local and production builds.
190
220
 
221
+ ==== Environment variables
222
+
223
+ This extension does not require any environment variables.
224
+
225
+ ==== Configuration options
226
+
227
+ There are no configurable options for this extension.
228
+
191
229
  ==== Registration example
192
230
 
193
231
  ```yaml
@@ -200,6 +238,14 @@ antora:
200
238
 
201
239
  This extension replaces the default https://gitlab.com/antora/antora/-/tree/v3.1.x/packages/redirect-producer[`produceRedirects()` function] in Antora to handle redirect loops caused by https://docs.antora.org/antora/latest/page/page-aliases/[page aliases]. Normally, page aliases in Antora are used to resolve outdated links without causing issues. However, with https://docs.antora.org/antora/latest/playbook/urls-html-extension-style/#html-extension-style-key[`indexify`], the same URL may inadvertently be used for both the source and target of a redirect, leading to loops. This problem is https://antora.zulipchat.com/#narrow/stream/282400-users/topic/Redirect.20Loop.20Issue.20with.20Page.20Renaming.20and.20Indexify/near/433691700[recognized as a bug] in core Antora. For example, creating a page alias for `modules/manage/security/authorization.adoc` to point to `modules/manage/security/authorization/index.adoc' can lead to a redirect loop where `manage/security/authorization/` points to `manage/security/authorization/`. Furthermore, omitting the alias would lead to `xref not found` errors because Antora relies on the alias to resolve the old xrefs. This extension is necessary until such behaviors are natively supported or fixed in Antora core.
202
240
 
241
+ ==== Environment variables
242
+
243
+ This extension does not require any environment variables.
244
+
245
+ ==== Configuration options
246
+
247
+ There are no configurable options for this extension.
248
+
203
249
  ==== Registration example
204
250
 
205
251
  ```yaml
@@ -219,6 +265,14 @@ This extension replaces AsciiDoc attribute placeholders with their respective va
219
265
  - If the same attribute placeholder is used multiple times within a file, all instances will be replaced with the attribute's value.
220
266
  ====
221
267
 
268
+ ==== Environment variables
269
+
270
+ This extension does not require any environment variables.
271
+
272
+ ==== Configuration options
273
+
274
+ There are no configurable options for this extension.
275
+
222
276
  ==== Registration example
223
277
 
224
278
  ```yaml
@@ -235,6 +289,14 @@ This extension aggregates all term pages from the {url-playbook}[`shared` compon
235
289
  - Looks for glossary pages named `reference:glossary.adoc` in all versions of all components and appends the contents of each term file to the glossary in alphabetical order.
236
290
  - If a glossary page is found, sets the `glossary-page` attribute of the <<glossterm, `glossterm` macro>> to `reference:glossary.adoc` so that terms can be linked to the glossary page.
237
291
 
292
+ ==== Environment variables
293
+
294
+ This extension does not require any environment variables.
295
+
296
+ ==== Configuration options
297
+
298
+ There are no configurable options for this extension.
299
+
238
300
  ==== Registration example
239
301
 
240
302
  ```yaml
@@ -249,6 +311,10 @@ This extension identifies and logs any pages that aren't listed in the navigatio
249
311
 
250
312
  IMPORTANT: By default, this extension excludes components named 'api'. This behavior is hardcoded and cannot be changed in the configuration.
251
313
 
314
+ ==== Environment variables
315
+
316
+ This extension does not require any environment variables.
317
+
252
318
  ==== Configuration options
253
319
 
254
320
  This extension accepts the following configuration options:
@@ -175,7 +175,7 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
175
175
  .replace(/\s+/g, ' ')
176
176
  .trim();
177
177
 
178
- var tag = `${component.title} ${version ? 'v' + version : ''}`
178
+ var tag = `${component.title} ${version ? 'v' + version : ''}`.trim();
179
179
  var indexItem;
180
180
  const deployment = page.asciidoc?.attributes['env-kubernetes'] ? 'Kubernetes' : page.asciidoc?.attributes['env-linux'] ? 'Linux' : page.asciidoc?.attributes['env-docker'] ? 'Docker' : page.asciidoc?.attributes['page-cloud'] ? 'Redpanda Cloud' : ''
181
181
 
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ const GetLatestConnectTag = require('./version-fetcher/get-latest-connect');
4
+
5
+ module.exports.register = function ({ config }) {
6
+ const logger = this.getLogger('modify-connect-tag-playbook-extension');
7
+
8
+ this.on('contextStarted', async ({ playbook }) => {
9
+ try {
10
+ // Fetch the latest release tag for redpanda-data/connect
11
+ const sourceUrl = 'https://github.com/redpanda-data/connect';
12
+ if (playbook && playbook.content && playbook.content.sources) {
13
+ const source = playbook.content.sources.find(source => source.url === sourceUrl);
14
+ if (source) {
15
+ const latestTag = await GetLatestConnectTag();
16
+ if (latestTag) {
17
+ source.tags[0] = latestTag;
18
+ this.updateVariables({ playbook });
19
+ }
20
+ }
21
+ }
22
+ } catch (error) {
23
+ console.error('Failed to update playbook with the latest Redpanda Connect tag:', error);
24
+ }
25
+ });
26
+ }
@@ -0,0 +1,28 @@
1
+ // Fetch the latest release version from GitHub
2
+ const { Octokit } = require("@octokit/rest");
3
+ const { retry } = require("@octokit/plugin-retry");
4
+ const OctokitWithRetries = Octokit.plugin(retry);
5
+ const owner = 'redpanda-data';
6
+ const repo = 'connect';
7
+
8
+ let githubOptions = {
9
+ userAgent: 'Redpanda Docs',
10
+ baseUrl: 'https://api.github.com',
11
+ };
12
+
13
+ if (process.env.REDPANDA_GITHUB_TOKEN) {
14
+ githubOptions.auth = process.env.REDPANDA_GITHUB_TOKEN;
15
+ }
16
+
17
+ const github = new OctokitWithRetries(githubOptions);
18
+
19
+ module.exports = async () => {
20
+ try {
21
+ const release = await github.rest.repos.getLatestRelease({ owner, repo });
22
+ tag = release.data.tag_name;
23
+ return tag;
24
+ } catch (error) {
25
+ console.error(error);
26
+ return null;
27
+ }
28
+ };
@@ -2,6 +2,7 @@ const GetLatestRedpandaVersion = require('./get-latest-redpanda-version')
2
2
  const GetLatestConsoleVersion = require('./get-latest-console-version')
3
3
  const GetLatestOperatorVersion = require('./get-latest-operator-version')
4
4
  const GetLatestHelmChartVersion = require('./get-latest-redpanda-helm-version')
5
+ const GetLatestConnectVersion = require('./get-latest-connect')
5
6
  const chalk = require('chalk')
6
7
  const semver = require('semver')
7
8
 
@@ -17,13 +18,15 @@ module.exports.register = function ({ config }) {
17
18
  GetLatestRedpandaVersion(),
18
19
  GetLatestConsoleVersion(),
19
20
  GetLatestOperatorVersion(),
20
- GetLatestHelmChartVersion()
21
+ GetLatestHelmChartVersion(),
22
+ GetLatestConnectVersion()
21
23
  ])
22
24
 
23
25
  const LatestRedpandaVersion = results[0].status === 'fulfilled' ? results[0].value : null
24
26
  const LatestConsoleVersion = results[1].status === 'fulfilled' ? results[1].value : null
25
27
  const LatestOperatorVersion = results[2].status === 'fulfilled' ? results[2].value : null
26
28
  const LatestHelmChartVersion = results[3].status === 'fulfilled' ? results[3].value : null
29
+ const LatestConnectVersion = results[4].status === 'fulfilled' ? results[4].value : null
27
30
 
28
31
  const components = await contentCatalog.getComponents()
29
32
  components.forEach(component => {
@@ -32,6 +35,10 @@ module.exports.register = function ({ config }) {
32
35
  asciidoc.attributes['latest-console-version'] = `${LatestConsoleVersion}@`
33
36
  logger.info(`Set Redpanda Console version to ${LatestConsoleVersion} in ${name} ${version}`)
34
37
  }
38
+ if (LatestConnectVersion) {
39
+ asciidoc.attributes['latest-connect-version'] = `${LatestConnectVersion}@`
40
+ logger.info(`Set Redpanda Connect version to ${LatestConnectVersion} in ${name} ${version}`)
41
+ }
35
42
  })
36
43
 
37
44
  if (!component.latest.asciidoc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "3.3.2",
3
+ "version": "3.4.0",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -33,6 +33,7 @@
33
33
  "./extensions/generate-rp-connect-categories": "./extensions/generate-rp-connect-categories.js",
34
34
  "./extensions/add-global-attributes": "./extensions/add-global-attributes.js",
35
35
  "./extensions/version-fetcher/set-latest-version": "./extensions/version-fetcher/set-latest-version.js",
36
+ "./extensions/modify-connect-tag-playbook": "./extensions/modify-connect-tag-playbook.js",
36
37
  "./extensions/validate-attributes": "./extensions/validate-attributes.js",
37
38
  "./extensions/find-related-docs": "./extensions/find-related-docs.js",
38
39
  "./extensions/unpublish-pages": "./extensions/unpublish-pages.js",