From 82896fa0dd535144c5e6ba1ba65e46e1b47d05cb Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:17:33 -0300 Subject: [PATCH 1/6] ansible: stop promotion if missing assets --- ansible/www-standalone/tools/promote/check_assets.js | 2 ++ ansible/www-standalone/tools/promote/promote_release.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/www-standalone/tools/promote/check_assets.js b/ansible/www-standalone/tools/promote/check_assets.js index a02e143df..cc4cad316 100755 --- a/ansible/www-standalone/tools/promote/check_assets.js +++ b/ansible/www-standalone/tools/promote/check_assets.js @@ -188,6 +188,8 @@ async function execute () { caution = true console.log(` \u001b[33m\u001b[1m⚠\u001b[22m\u001b[39m The following assets are expected for ${line} but are currently missing from staging:`) notInActual.forEach((a) => console.log(` • ${a}`)) + console.log('Canceling the promotion') + process.exit(1) } // bogus unexpected files found in staging, not good diff --git a/ansible/www-standalone/tools/promote/promote_release.sh b/ansible/www-standalone/tools/promote/promote_release.sh index 688476cbf..8a4ecc888 100755 --- a/ansible/www-standalone/tools/promote/promote_release.sh +++ b/ansible/www-standalone/tools/promote/promote_release.sh @@ -22,7 +22,7 @@ srcdir=$release_srcdir dstdir=$release_dstdir dirmatch=$release_dirmatch -node --no-warnings /home/staging/tools/promote/check_assets.js $srcdir/$2 $dstdir/$2 +node --no-warnings /home/staging/tools/promote/check_assets.js $srcdir/$2 $dstdir/$2 || exit 1 relative_srcdir=${srcdir/$staging_rootdir/"$site/"} relative_dstdir=${dstdir/$dist_rootdir/"$site/"} From becb35a1e710e177d0b20e419946d30aae95f109 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:20:33 -0300 Subject: [PATCH 2/6] fixup! ansible: stop promotion if missing assets --- ansible/www-standalone/tools/promote/check_assets.js | 2 +- ansible/www-standalone/tools/promote/test/check_r2_assets.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/www-standalone/tools/promote/check_assets.js b/ansible/www-standalone/tools/promote/check_assets.js index cc4cad316..f8660f5f8 100755 --- a/ansible/www-standalone/tools/promote/check_assets.js +++ b/ansible/www-standalone/tools/promote/check_assets.js @@ -188,7 +188,7 @@ async function execute () { caution = true console.log(` \u001b[33m\u001b[1m⚠\u001b[22m\u001b[39m The following assets are expected for ${line} but are currently missing from staging:`) notInActual.forEach((a) => console.log(` • ${a}`)) - console.log('Canceling the promotion') + console.log('... Canceling the promotion') process.exit(1) } diff --git a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs index 05a2c438c..af754b1ee 100644 --- a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs +++ b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs @@ -51,7 +51,7 @@ const testcases = [ ' \x1B[33m\x1B[1m⚠\x1B[22m\x1B[39m The following assets are expected for v22.x but are currently missing from R2 staging:\n' + ' • node-v22.12.0-linux-armv7l.tar.gz\n' + ' • node-v22.12.0-linux-armv7l.tar.xz\n' + - ' \u001b[33mPromote if you are certain this is the the correct course of action\u001b[39m\n', + '... Canceling the promotion', setup: async function setup (context) { context.rcloneLs[context.r2StagingDir] = await fixture('partial-v22.12.0.json'); } From 51b86c9f82c4a366a090bf65d37d7d7b3e32eb8e Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:26:20 -0300 Subject: [PATCH 3/6] fixup! ansible: stop promotion if missing assets --- ansible/www-standalone/tools/promote/check_assets.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/www-standalone/tools/promote/check_assets.test.mjs b/ansible/www-standalone/tools/promote/check_assets.test.mjs index 232b72fe4..484498381 100755 --- a/ansible/www-standalone/tools/promote/check_assets.test.mjs +++ b/ansible/www-standalone/tools/promote/check_assets.test.mjs @@ -86,7 +86,7 @@ const testcases = [ ' • node-v10.1.0-linux-armv6l.tar.gz\n' + ' • node-v10.1.0-linux-armv6l.tar.xz\n' + ' • node-v10.1.0.pkg\n' + - ' \u001b[33mPromote if you are certain this is the the correct course of action\u001b[39m\n', + '... Canceling the promotion', setup: async function setup (version, fixtureStagingDir, fixtureDistDir) { await makeFixture(version, true, fixtureStagingDir); await Promise.all([ From 42954280088775a5d9ad55e689104e625185722d Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:34:38 -0300 Subject: [PATCH 4/6] fixup! fixup! ansible: stop promotion if missing assets --- .../tools/promote/check_assets.test.mjs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ansible/www-standalone/tools/promote/check_assets.test.mjs b/ansible/www-standalone/tools/promote/check_assets.test.mjs index 484498381..5b0dc75f9 100755 --- a/ansible/www-standalone/tools/promote/check_assets.test.mjs +++ b/ansible/www-standalone/tools/promote/check_assets.test.mjs @@ -10,13 +10,12 @@ async function executeMe (stagingDir, distDir) { return new Promise((resolve, reject) => { const args = [ '--no-warnings', join(import.meta.dirname, 'check_assets.js'), stagingDir, distDir ]; execFile(process.execPath, args, (err, stdout, stderr) => { - if (err) { - return reject(err); - } if (stderr) { console.log('STDERR:', stderr); } - resolve(stdout); + // Return both stdout and exit code, even if there's an error + const exitCode = err ? (err.code || 1) : 0; + resolve({ stdout, exitCode }); }); }); } @@ -86,7 +85,8 @@ const testcases = [ ' • node-v10.1.0-linux-armv6l.tar.gz\n' + ' • node-v10.1.0-linux-armv6l.tar.xz\n' + ' • node-v10.1.0.pkg\n' + - '... Canceling the promotion', + '... Canceling the promotion\n', + expectedExitCode: 1, setup: async function setup (version, fixtureStagingDir, fixtureDistDir) { await makeFixture(version, true, fixtureStagingDir); await Promise.all([ @@ -159,11 +159,8 @@ const testcases = [ ' • node-v9.9.9-linux-x86.tar.xz\n' + ' • node-v9.9.9-sunos-x86.tar.gz\n' + ' • node-v9.9.9-sunos-x86.tar.xz\n' + - ' \u001b[31m\u001b[1m✖\u001b[22m\u001b[39m The following assets were found in staging but are not expected for v9.x:\n' + - ' • docs/apilinks.json\n' + - ' Does the expected assets list for v9.x need to be updated?\n' + - ' https://github.com/nodejs/build/tree/main/ansible/www-standalone/tools/promote/expected_assets/v9.x\n' + - ' \u001b[33mPromote if you are certain this is the the correct course of action\u001b[39m\n', + '... Canceling the promotion\n', + expectedExitCode: 1, setup: async function setup (version, fixtureStagingDir, fixtureDistDir) { // use the 10.x list, which is missing the x86 files, it'll check the 9.x const expectedAssets = await loadExpectedAssets(version, 'v10.x'); @@ -303,14 +300,15 @@ describe(`${basename(import.meta.filename, '.test.mjs')} tests`, async () => { afterEach(async (context) => { await rm(context.testDir, { recursive: true, force: true, maxRetries: 10 }); }); - for (const { name, version, expectedStdout, setup } of testcases) { + for (const { name, version, expectedStdout, expectedExitCode = 0, setup } of testcases) { it(name, async (context) => { const fixtureStagingDir = join(context.fixtureStagingDir, version); const fixtureDistDir = join(context.fixtureDistDir, version); await setup(version, fixtureStagingDir, fixtureDistDir); - const stdout = await executeMe(fixtureStagingDir, fixtureDistDir); + const { stdout, exitCode } = await executeMe(fixtureStagingDir, fixtureDistDir); assert.strictEqual(stdout, expectedStdout); + assert.strictEqual(exitCode, expectedExitCode); }); } }); From dce7c1155d7c76e57b2224a1fa5e54d3ed95320a Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:39:46 -0300 Subject: [PATCH 5/6] fixup! fixup! ansible: stop promotion if missing assets --- ansible/www-standalone/tools/promote/test/check_r2_assets.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs index af754b1ee..319669a60 100644 --- a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs +++ b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs @@ -51,7 +51,7 @@ const testcases = [ ' \x1B[33m\x1B[1m⚠\x1B[22m\x1B[39m The following assets are expected for v22.x but are currently missing from R2 staging:\n' + ' • node-v22.12.0-linux-armv7l.tar.gz\n' + ' • node-v22.12.0-linux-armv7l.tar.xz\n' + - '... Canceling the promotion', + ' \x1B[33mPromote if you are certain this is the the correct course of action\x1B[39m\n', setup: async function setup (context) { context.rcloneLs[context.r2StagingDir] = await fixture('partial-v22.12.0.json'); } From d366718a3a3ef260f3158bacb0dc4a2479a24ca8 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Thu, 9 Oct 2025 10:47:56 -0300 Subject: [PATCH 6/6] fixup! fixup! fixup! ansible: stop promotion if missing assets --- ansible/www-standalone/tools/promote/test/check_r2_assets.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs index 319669a60..05a2c438c 100644 --- a/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs +++ b/ansible/www-standalone/tools/promote/test/check_r2_assets.mjs @@ -51,7 +51,7 @@ const testcases = [ ' \x1B[33m\x1B[1m⚠\x1B[22m\x1B[39m The following assets are expected for v22.x but are currently missing from R2 staging:\n' + ' • node-v22.12.0-linux-armv7l.tar.gz\n' + ' • node-v22.12.0-linux-armv7l.tar.xz\n' + - ' \x1B[33mPromote if you are certain this is the the correct course of action\x1B[39m\n', + ' \u001b[33mPromote if you are certain this is the the correct course of action\u001b[39m\n', setup: async function setup (context) { context.rcloneLs[context.r2StagingDir] = await fixture('partial-v22.12.0.json'); }