@redpanda-data/docs-extensions-and-macros 5.29.0 → 5.31.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/bin/doc-tools.js +54 -19
- package/bin/mcp-tools/versions.js +1 -1
- package/cli-utils/enterprise-sources.js +6 -6
- package/cli-utils/install-test-dependencies.sh +58 -6
- package/extensions/version-fetcher/set-latest-version.js +11 -2
- package/mcp/CLI_INTERFACE.adoc +1 -1
- package/mcp/USER_GUIDE.adoc +4 -4
- package/package.json +1 -1
- package/tools/bundle-openapi.js +28 -10
- package/tools/get-redpanda-version.js +14 -1
- package/tools/property-extractor/Makefile +99 -42
- package/tools/property-extractor/README.adoc +1 -1
- package/tools/property-extractor/cloud_config.py +11 -7
- package/tools/property-extractor/merge-rp-util.js +208 -0
- package/tools/property-extractor/rp-util-fetch.js +447 -0
- package/tools/property-extractor/rp_util_merge.py +599 -0
- package/tools/property-extractor/templates/property.hbs +12 -5
- package/tools/property-extractor/templates/topic-property.hbs +7 -4
- package/tools/rpk-docs/rpk-docs-handler.js +98 -16
|
@@ -241,7 +241,31 @@ function prepareSourceFromRef(sourceRef, sourcePath = null) {
|
|
|
241
241
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rpk-source-'))
|
|
242
242
|
const repoDir = path.join(tmpDir, 'redpanda')
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
// streaming-enterprise is private, so a token is required. Auth travels
|
|
245
|
+
// via a credential helper registered through GIT_CONFIG_* environment
|
|
246
|
+
// variables, never as a git -c argument, so the token cannot appear in
|
|
247
|
+
// this process's argv (visible to anything that can list processes) and
|
|
248
|
+
// never embedded in the remote URL, so no token is persisted in the
|
|
249
|
+
// clone's .git/config either.
|
|
250
|
+
const { getGitHubToken } = require('../../cli-utils/github-token')
|
|
251
|
+
const token = getGitHubToken()
|
|
252
|
+
if (!token) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
'redpanda-data/streaming-enterprise is a private repository.\n' +
|
|
255
|
+
'Set GH_TOKEN, GITHUB_TOKEN, or REDPANDA_GITHUB_TOKEN so the clone can authenticate.'
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
const gitEnv = {
|
|
259
|
+
...process.env,
|
|
260
|
+
RPK_SOURCE_CLONE_TOKEN: token,
|
|
261
|
+
GIT_CONFIG_COUNT: '2',
|
|
262
|
+
GIT_CONFIG_KEY_0: 'credential.helper',
|
|
263
|
+
GIT_CONFIG_VALUE_0: '',
|
|
264
|
+
GIT_CONFIG_KEY_1: 'credential.https://github.com.helper',
|
|
265
|
+
GIT_CONFIG_VALUE_1: '!f() { echo "username=x-access-token"; echo "password=$RPK_SOURCE_CLONE_TOKEN"; }; f'
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
console.log(`Sparse-cloning streaming-enterprise repo (ref: ${sourceRef}) to ${repoDir}...`)
|
|
245
269
|
|
|
246
270
|
// Clone with sparse checkout
|
|
247
271
|
const cloneResult = spawnSync('git', [
|
|
@@ -250,27 +274,31 @@ function prepareSourceFromRef(sourceRef, sourcePath = null) {
|
|
|
250
274
|
'--filter=blob:none',
|
|
251
275
|
'--sparse',
|
|
252
276
|
'--branch', sourceRef,
|
|
253
|
-
'https://github.com/redpanda-data/
|
|
277
|
+
'https://github.com/redpanda-data/streaming-enterprise.git',
|
|
254
278
|
repoDir
|
|
255
279
|
], {
|
|
256
280
|
encoding: 'utf8',
|
|
257
281
|
timeout: 120000,
|
|
282
|
+
env: gitEnv,
|
|
258
283
|
stdio: ['pipe', 'pipe', 'pipe']
|
|
259
284
|
})
|
|
260
285
|
|
|
261
286
|
if (cloneResult.status !== 0) {
|
|
262
287
|
throw new Error(
|
|
263
|
-
`Failed to clone
|
|
288
|
+
`Failed to clone streaming-enterprise repo with ref '${sourceRef}'.\n` +
|
|
264
289
|
`Make sure the branch or tag exists.\n` +
|
|
265
290
|
`Error: ${cloneResult.stderr}`
|
|
266
291
|
)
|
|
267
292
|
}
|
|
268
293
|
|
|
269
|
-
// Set sparse checkout to only get rpk
|
|
294
|
+
// Set sparse checkout to only get rpk. With --filter=blob:none, the blobs
|
|
295
|
+
// for src/go/rpk were not fetched by the clone above and are pulled lazily
|
|
296
|
+
// here, so this invocation needs the same credential helper.
|
|
270
297
|
const sparseResult = spawnSync('git', ['sparse-checkout', 'set', 'src/go/rpk'], {
|
|
271
298
|
cwd: repoDir,
|
|
272
299
|
encoding: 'utf8',
|
|
273
|
-
timeout: 60000
|
|
300
|
+
timeout: 60000,
|
|
301
|
+
env: gitEnv
|
|
274
302
|
})
|
|
275
303
|
|
|
276
304
|
if (sparseResult.status !== 0) {
|
|
@@ -292,8 +320,8 @@ function fetchRpkTreeFromSource(sourcePath) {
|
|
|
292
320
|
if (!fs.existsSync(sourcePath)) {
|
|
293
321
|
throw new Error(
|
|
294
322
|
`rpk source directory not found: ${sourcePath}\n` +
|
|
295
|
-
'To use --from-source, you need a local checkout of the
|
|
296
|
-
'Clone it with: git clone https://github.com/redpanda-data/
|
|
323
|
+
'To use --from-source, you need a local checkout of the streaming-enterprise repository (private).\n' +
|
|
324
|
+
'Clone it with: git clone https://github.com/redpanda-data/streaming-enterprise.git\n' +
|
|
297
325
|
'Then point to: <repo>/src/go/rpk'
|
|
298
326
|
)
|
|
299
327
|
}
|
|
@@ -393,8 +421,8 @@ function fetchRpkTreeFromLinuxSource(sourcePath, pluginPins = {}) {
|
|
|
393
421
|
if (!fs.existsSync(absoluteSourcePath)) {
|
|
394
422
|
throw new Error(
|
|
395
423
|
`rpk source directory not found: ${absoluteSourcePath}\n` +
|
|
396
|
-
'Expected a checkout of the
|
|
397
|
-
'Clone it with: git clone https://github.com/redpanda-data/
|
|
424
|
+
'Expected a checkout of the streaming-enterprise repository (private).\n' +
|
|
425
|
+
'Clone it with: git clone https://github.com/redpanda-data/streaming-enterprise.git'
|
|
398
426
|
)
|
|
399
427
|
}
|
|
400
428
|
|
|
@@ -1292,16 +1320,69 @@ function downloadRpkRelease(tag, destDir) {
|
|
|
1292
1320
|
return null
|
|
1293
1321
|
}
|
|
1294
1322
|
|
|
1323
|
+
// Releases now publish to streaming-enterprise (private), not the public
|
|
1324
|
+
// redpanda-data/redpanda. This function already has a fallback (the
|
|
1325
|
+
// caller builds from source instead), so a missing token warns and
|
|
1326
|
+
// returns null here rather than throwing the way the clone-only paths do.
|
|
1327
|
+
const { getGitHubToken } = require('../../cli-utils/github-token')
|
|
1328
|
+
const token = getGitHubToken()
|
|
1329
|
+
if (!token) {
|
|
1330
|
+
console.warn('No GitHub token available for the private streaming-enterprise release download; falling back to a source build.')
|
|
1331
|
+
return null
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1295
1334
|
const assetName = `rpk-${osName}-${archName}.zip`
|
|
1296
|
-
const
|
|
1335
|
+
const checksumAsset = `rpk_${tag.replace(/^v/, '')}_checksums.txt`
|
|
1297
1336
|
const zipPath = path.join(destDir, assetName)
|
|
1337
|
+
// The Authorization header reaches curl through a config file on stdin
|
|
1338
|
+
// (--config -), never as an -H argument: an argv header is readable by
|
|
1339
|
+
// any process on the host (ps, /proc) for as long as the transfer runs.
|
|
1340
|
+
const curlAuthConfig = `header = "Authorization: token ${token}"`
|
|
1341
|
+
|
|
1342
|
+
// streaming-enterprise is private, so the release's browser download URL
|
|
1343
|
+
// (releases/download/<tag>/<asset>) 404s even with a valid token: it
|
|
1344
|
+
// redirects to a signed storage URL that requires an authenticated
|
|
1345
|
+
// browser session, not a bearer token. Only the API's per-asset url
|
|
1346
|
+
// (asset.url, not asset.browser_download_url) accepts this Authorization
|
|
1347
|
+
// header, so resolve assets through the release-by-tag API first.
|
|
1348
|
+
const releaseResult = spawnSync('curl', [
|
|
1349
|
+
'-fsSL', '--retry', '5', '--retry-all-errors',
|
|
1350
|
+
'--connect-timeout', '30', '--max-time', '60',
|
|
1351
|
+
'--config', '-',
|
|
1352
|
+
'-H', 'Accept: application/vnd.github+json',
|
|
1353
|
+
`https://api.github.com/repos/redpanda-data/streaming-enterprise/releases/tags/${tag}`
|
|
1354
|
+
], { encoding: 'utf8', input: curlAuthConfig, timeout: 90000 })
|
|
1355
|
+
|
|
1356
|
+
if (releaseResult.status !== 0) {
|
|
1357
|
+
console.warn(`Could not look up release ${tag} from streaming-enterprise (draft or missing release)`)
|
|
1358
|
+
return null
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
let release
|
|
1362
|
+
try {
|
|
1363
|
+
release = JSON.parse(releaseResult.stdout)
|
|
1364
|
+
} catch {
|
|
1365
|
+
console.warn(`Could not parse release metadata for ${tag}`)
|
|
1366
|
+
return null
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
const assetUrl = (release.assets || []).find(a => a.name === assetName)?.url
|
|
1370
|
+
if (!assetUrl) {
|
|
1371
|
+
console.warn(`Release ${tag} has no asset named ${assetName} (draft or missing release asset)`)
|
|
1372
|
+
return null
|
|
1373
|
+
}
|
|
1374
|
+
const checksumUrl = (release.assets || []).find(a => a.name === checksumAsset)?.url
|
|
1298
1375
|
|
|
1299
1376
|
console.log(`Downloading ${assetName} for ${tag}...`)
|
|
1377
|
+
// Accept: application/octet-stream is required on the API asset url to
|
|
1378
|
+
// receive the binary itself instead of its JSON metadata.
|
|
1300
1379
|
const curlResult = spawnSync('curl', [
|
|
1301
1380
|
'-fL', '--retry', '5', '--retry-all-errors',
|
|
1302
1381
|
'--connect-timeout', '30', '--max-time', '300',
|
|
1303
|
-
'
|
|
1304
|
-
|
|
1382
|
+
'--config', '-',
|
|
1383
|
+
'-H', 'Accept: application/octet-stream',
|
|
1384
|
+
'-o', zipPath, assetUrl
|
|
1385
|
+
], { encoding: 'utf8', input: curlAuthConfig, timeout: 360000 })
|
|
1305
1386
|
|
|
1306
1387
|
if (curlResult.status !== 0) {
|
|
1307
1388
|
console.warn(`Could not download rpk release for ${tag} (draft or missing release asset)`)
|
|
@@ -1309,12 +1390,13 @@ function downloadRpkRelease(tag, destDir) {
|
|
|
1309
1390
|
}
|
|
1310
1391
|
|
|
1311
1392
|
// Verify against the release checksum file when it exists
|
|
1312
|
-
const checksumAsset = `rpk_${tag.replace(/^v/, '')}_checksums.txt`
|
|
1313
1393
|
const checksumPath = path.join(destDir, checksumAsset)
|
|
1314
|
-
const checksumResult = spawnSync('curl', [
|
|
1394
|
+
const checksumResult = checksumUrl ? spawnSync('curl', [
|
|
1315
1395
|
'-fsSL', '--retry', '3', '--connect-timeout', '30', '--max-time', '60',
|
|
1316
|
-
'
|
|
1317
|
-
|
|
1396
|
+
'--config', '-',
|
|
1397
|
+
'-H', 'Accept: application/octet-stream',
|
|
1398
|
+
'-o', checksumPath, checksumUrl
|
|
1399
|
+
], { encoding: 'utf8', input: curlAuthConfig, timeout: 90000 }) : { status: 1 }
|
|
1318
1400
|
|
|
1319
1401
|
if (checksumResult.status === 0) {
|
|
1320
1402
|
const expectedLine = fs.readFileSync(checksumPath, 'utf8')
|