From a17b0b5a89a07a6d0fca8d137c8e72eac0fd7ca9 Mon Sep 17 00:00:00 2001 From: JakeSCahill Date: Fri, 23 Oct 2026 09:07:18 +0100 Subject: [PATCH 1/3] Stop gulp bundle hanging when antora.yml cannot be fetched --- compile-partial.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile-partial.js b/compile-partial.js index 4a5b181e..dfc31416 100644 --- a/compile-partial.js +++ b/compile-partial.js @@ -22,8 +22,12 @@ if (fs.existsSync(helpersDir)) { function fetchRemoteAntoraVersion() { const url = 'https://raw.githubusercontent.com/redpanda-data/docs/main/antora.yml' return new Promise((resolve, reject) => { - https.get(url, res => { + // agent: false so no kept-alive socket holds the process open afterwards. + const req = https.get(url, { agent: false }, res => { if (res.statusCode !== 200) { + // Drain the response: an unread body keeps the socket, and the + // process, open, so the build hangs here (docs is private: 404). + res.resume() return reject(new Error(`Failed to fetch antora.yml: ${res.statusCode}`)) } let body = '' @@ -40,7 +44,9 @@ function fetchRemoteAntoraVersion() { reject(err) } }) - }).on('error', reject) + }) + req.on('error', reject) + req.setTimeout(10000, () => req.destroy(new Error('timed out after 10 s'))) }) } From 38569c5354acce5fa815840dcfac48fa2a6dc61d Mon Sep 17 00:00:00 2001 From: JakeSCahill Date: Fri, 23 Oct 2026 09:18:57 +0100 Subject: [PATCH 2/3] Read the latest Redpanda version from the live docs site for the Bump widgets, and fail CI builds without one --- compile-partial.js | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/compile-partial.js b/compile-partial.js index dfc31416..48c30535 100644 --- a/compile-partial.js +++ b/compile-partial.js @@ -2,7 +2,6 @@ const fs = require('fs'); const path = require('path'); const Handlebars = require('handlebars'); const https = require('https'); -const yaml = require('js-yaml'); const helpersDir = path.join(__dirname, 'src', 'helpers'); if (fs.existsSync(helpersDir)) { @@ -19,30 +18,31 @@ if (fs.existsSync(helpersDir)) { }); } -function fetchRemoteAntoraVersion() { - const url = 'https://raw.githubusercontent.com/redpanda-data/docs/main/antora.yml' +// The latest Self-Managed version, as the live docs site states it in every +// page's . The site is public, so this +// needs no token (redpanda-data/docs, which holds antora.yml, is private). +const LATEST_VERSION_URL = 'https://docs.redpanda.com/home/' + +function fetchLatestVersion () { return new Promise((resolve, reject) => { // agent: false so no kept-alive socket holds the process open afterwards. - const req = https.get(url, { agent: false }, res => { + const req = https.get(LATEST_VERSION_URL, { agent: false }, (res) => { if (res.statusCode !== 200) { // Drain the response: an unread body keeps the socket, and the - // process, open, so the build hangs here (docs is private: 404). + // process, open, so the build would hang here. res.resume() - return reject(new Error(`Failed to fetch antora.yml: ${res.statusCode}`)) + return reject(new Error(`${LATEST_VERSION_URL} returned ${res.statusCode}`)) } let body = '' - res.on('data', chunk => (body += chunk)) + res.setEncoding('utf8') + res.on('data', (chunk) => (body += chunk)) res.on('end', () => { - try { - const cfg = yaml.load(body) - if (cfg.version == null) { - throw new Error('version field missing') - } - const version = String(cfg.version).trim() - resolve(version) - } catch (err) { - reject(err) + const match = / Date: Tue, 27 Oct 2026 10:28:02 +0000 Subject: [PATCH 3/3] Handle response stream errors and only fail the version lookup when CI is true --- compile-partial.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile-partial.js b/compile-partial.js index 48c30535..51b49b68 100644 --- a/compile-partial.js +++ b/compile-partial.js @@ -35,6 +35,8 @@ function fetchLatestVersion () { } let body = '' res.setEncoding('utf8') + // A connection dropped mid-body errors on res, not req. + res.on('error', reject) res.on('data', (chunk) => (body += chunk)) res.on('end', () => { const match = /