Skip to content

Commit eb017a0

Browse files
authored
Merge branch 'main' into yargs-18
2 parents 49a96ae + 63e66a8 commit eb017a0

File tree

10 files changed

+65
-36
lines changed

10 files changed

+65
-36
lines changed

eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ export default [
1818
'coverage/',
1919
'node_modules/',
2020
'lib/wpt/templates/',
21+
'test/fixtures/release/*.js', // Copied from the nodejs/node repo
2122
],
2223
},
2324
{
2425
languageOptions: {
25-
globals: globals.node,
26+
globals: globals.nodeBuiltin,
2627
sourceType: 'module',
2728
ecmaVersion: 'latest',
2829
},
@@ -42,5 +43,22 @@ export default [
4243
'n/no-process-exit': 'off',
4344
'n/no-unsupported-features/node-builtins': 'off',
4445
},
46+
settings: {
47+
'import/resolver': {
48+
node: {
49+
pathFilter(pkg, path, relativePath) {
50+
const pkgExport = relativePath
51+
? pkg.exports?.[`./${relativePath}`]
52+
: pkg.exports?.['.'];
53+
return pkgExport?.import?.default ??
54+
pkgExport?.import ??
55+
pkgExport?.[0]?.import ??
56+
pkgExport?.default ??
57+
pkgExport ??
58+
(relativePath || pkg.main);
59+
},
60+
},
61+
},
62+
},
4563
},
4664
];

lib/promote_release.js

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import path from 'node:path';
22
import fs from 'node:fs/promises';
3+
import { tmpdir } from 'node:os';
4+
import { pipeline } from 'node:stream/promises';
35
import semver from 'semver';
46
import * as gst from 'git-secure-tag';
57

@@ -196,31 +198,44 @@ export default class ReleasePromotion extends Session {
196198

197199
async verifyTagSignature(version) {
198200
const { cli } = this;
199-
const verifyTagPattern = /gpg:[^\n]+\ngpg:\s+using \w+ key ([^\n]+)\ngpg:\s+issuer "([^"]+)"\ngpg:\s+Good signature from (?:"[^"]+"(?: \[ultimate\])?\ngpg:\s+aka )*"([^<]+) <\2>"/;
200-
const [verifyTagOutput, haystack] = await Promise.all([forceRunAsync(
201-
'git', ['--no-pager',
202-
'verify-tag',
203-
`v${version}`
204-
], { ignoreFailure: false, captureStderr: true }), fs.readFile('README.md')]);
205-
const match = verifyTagPattern.exec(verifyTagOutput);
206-
if (match == null) {
207-
cli.warn('git was not able to verify the tag:');
208-
cli.info(verifyTagOutput);
209-
} else {
210-
const [, keyID, email, name] = match;
211-
const needle = `* **${name}** <<${email}>>\n ${'`'}${keyID}${'`'}`;
212-
if (haystack.includes(needle)) {
213-
return;
201+
202+
cli.startSpinner('Downloading active releasers keyring from nodejs/release-keys...');
203+
const [keyRingStream, [GNUPGHOME, keyRingFd]] = await Promise.all([
204+
fetch('https://github.com/nodejs/release-keys/raw/HEAD/gpg-only-active-keys/pubring.kbx'),
205+
fs.mkdtemp(path.join(tmpdir(), 'ncu-'))
206+
.then(async d => [d, await fs.open(path.join(d, 'pubring.kbx'), 'w')]),
207+
]);
208+
if (!keyRingStream.ok) throw new Error('Failed to download keyring', { cause: keyRingStream });
209+
await pipeline(keyRingStream.body, keyRingFd.createWriteStream());
210+
cli.stopSpinner('Active releasers keyring stored in temp directory');
211+
212+
try {
213+
await forceRunAsync(
214+
'git', ['--no-pager',
215+
'verify-tag',
216+
`v${version}`
217+
], {
218+
ignoreFailure: false,
219+
spawnArgs: { env: { ...process.env, GNUPGHOME } },
220+
});
221+
cli.ok('git tag signature verified');
222+
} catch (cause) {
223+
cli.error('git was not able to verify the tag');
224+
cli.warn('This means that either the tag was signed with the wrong key,');
225+
cli.warn('or that nodejs/release-keys contains outdated information.');
226+
cli.warn('The release should not proceed.');
227+
if (!await cli.prompt('Do you want to proceed anyway?', { defaultAnswer: false })) {
228+
if (await cli.prompt('Do you want to delete the local tag?')) {
229+
await forceRunAsync('git', ['tag', '-d', `v${version}`]);
230+
} else {
231+
cli.info(`Run 'git tag -d v${version}' to remove the local tag.`);
232+
}
233+
throw new Error('Aborted', { cause });
214234
}
215-
cli.warn('Tag was signed with an undocumented identity/key pair!');
216-
cli.info('Expected to find the following entry in the README:');
217-
cli.info(needle);
218-
cli.info('If you are using a subkey, it might be OK.');
219-
}
220-
cli.info(`If that doesn't sound right, consider removing the tag (git tag -d v${version
221-
}), check your local config, and start the process over.`);
222-
if (!await cli.prompt('Do you want to proceed anyway?', { defaultAnswer: false })) {
223-
throw new Error('Aborted');
235+
} finally {
236+
cli.startSpinner('Cleaning up temp files');
237+
await fs.rm(GNUPGHOME, { force: true, recursive: true });
238+
cli.stopSpinner('Temp files removed');
224239
}
225240
}
226241

lib/verbosity.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export function setVerbosityFromEnv() {
1818
if (Object.keys(VERBOSITY).includes(env)) {
1919
verbosity = VERBOSITY[env];
2020
}
21+
if (!isDebugVerbosity()) {
22+
Error.stackTraceLimit = 0;
23+
}
2124
};
2225

2326
export function debuglog(...args) {

lib/voting_session.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
getEditor, isGhAvailable
1111
} from './utils.js';
1212

13-
// eslint-disable-next-line import/no-unresolved
1413
import voteUsingGit from '@node-core/caritat/voteUsingGit';
1514
import * as yaml from 'js-yaml';
1615

test/fixtures/release/expected-test-process-release.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
// eslint-disable-next-line n/no-missing-require
43
require('../common');
54

65
const assert = require('assert');

test/fixtures/release/original-test-process-release.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
// eslint-disable-next-line n/no-missing-require
43
require('../common');
54

65
const assert = require('assert');

test/unit/ci_start.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, afterEach } from 'node:test';
32
import assert from 'assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65
import { FormData } from 'undici';
76

87
import {

test/unit/pr_checker.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, after, afterEach } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import PRData from '../../lib/pr_data.js';
87
import PRChecker from '../../lib/pr_checker.js';

test/unit/pr_data.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import PRData from '../../lib/pr_data.js';
87

test/unit/team_info.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, after } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import TestCLI from '../fixtures/test_cli.js';
87
import TeamInfo from '../../lib/team_info.js';

0 commit comments

Comments
 (0)