diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bbc056b..93033421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.2.3](https://github.com/nodejs/node-core-utils/compare/v7.2.2...v7.2.3) (2026-09-17) + + +### Bug Fixes + +* start CI when the duplicate check cannot query Jenkins ([#1195](https://github.com/nodejs/node-core-utils/issues/1195)) ([a3dc22c](https://github.com/nodejs/node-core-utils/commit/a3dc22cc0451016033c66b08d95d2867db6b67e0)) + ## [7.2.2](https://github.com/nodejs/node-core-utils/compare/v7.2.1...v7.2.2) (2026-09-15) diff --git a/lib/ci/run_ci.js b/lib/ci/run_ci.js index 30331766..7963849f 100644 --- a/lib/ci/run_ci.js +++ b/lib/ci/run_ci.js @@ -94,10 +94,20 @@ export class RunPRJob { if (checkForDuplicates) { await this.prData.getComments(); const { jobid, link } = new JobParser(this.prData.comments).parse().get('PR') ?? {}; - const { actions } = jobid - ? (await new PRBuild(cli, request, jobid, undefined, 'actions[parameters[name,value]]') - .getBuildData()) - : {}; + let actions; + try { + ({ actions } = jobid + ? (await new PRBuild(cli, request, jobid, undefined, 'actions[parameters[name,value]]') + .getBuildData()) + : {}); + } catch (err) { + // Jenkins may no longer have the build (e.g. the record was lost) or + // may answer with an HTML error page instead of JSON. Do not let that + // block starting a new CI run. + cli.stopSpinner(`Could not query existing CI run ${link}: ${err.message}`, + cli.SPINNER_STATUS.WARN); + cli.warn('Skipping the duplicate CI check'); + } const { parameters } = actions?.find(a => 'parameters' in a) ?? {}; if (parameters?.find(c => c.name === 'COMMIT_SHA_CHECK')?.value === certifySafe) { cli.info('Existing CI run found: ' + link); diff --git a/package-lock.json b/package-lock.json index 866823b5..21ca8023 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@node-core/utils", - "version": "7.2.2", + "version": "7.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@node-core/utils", - "version": "7.2.2", + "version": "7.2.3", "bundleDependencies": [ "@inquirer/prompts", "@listr2/prompt-adapter-inquirer", diff --git a/package.json b/package.json index 627f4044..fb2c4326 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@node-core/utils", - "version": "7.2.2", + "version": "7.2.3", "description": "Utilities for Node.js core collaborators", "type": "module", "engines": { diff --git a/test/unit/ci_start.test.js b/test/unit/ci_start.test.js index b2199288..7266ec78 100644 --- a/test/unit/ci_start.test.js +++ b/test/unit/ci_start.test.js @@ -335,5 +335,33 @@ describe('Jenkins', () => { const jobRunner = new RunPRJob(cli, request, owner, repo, prid, 'deadbeef', true); assert.strictEqual(await jobRunner.start(), true); }); + it('should start CI when the existing CI run cannot be queried', async() => { + const cli = new TestCLI(); + const err = new SyntaxError('Unexpected token \'<\', " { + assert.strictEqual(url, CI_PR_URL); + assert.strictEqual(method, 'POST'); + assert.deepStrictEqual(headers, { 'Jenkins-Crumb': crumb }); + return Promise.resolve({ status: 201 }); + }), + json: sinon.stub().withArgs(CI_CRUMB_URL).resolves({ crumb }) + }; + const jobRunner = new RunPRJob(cli, request, owner, repo, prid, 'deadbeef', true); + assert.strictEqual(await jobRunner.start(), true); + assert.strictEqual(request.fetch.callCount, 1); + }); }); });