From 9cdd289db0ec6d7932d75f5f633154efa919da25 Mon Sep 17 00:00:00 2001 From: Robo Date: Tue, 27 Jun 2023 01:20:59 +0900 Subject: [PATCH] chore: update node checksums (#186181) * chore: update node checksums * chore: bump distro --- build/gulpfile.reh.js | 32 ++++++++++++++++---------------- package.json | 2 +- remote/.yarnrc | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index 1435eb7b5f0..a235f55c79e 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -138,13 +138,10 @@ function getNodeChecksum(nodeVersion, platform, arch) { break; case 'darwin': + case 'alpine': case 'linux': expectedName = `node-v${nodeVersion}-${platform}-${arch}.tar.gz`; break; - - case 'alpine': - expectedName = `${platform}-${arch}/node`; - break; } const nodeJsChecksums = fs.readFileSync(path.join(REPO_ROOT, 'build', 'checksums', 'nodejs.txt'), 'utf8'); @@ -157,6 +154,13 @@ function getNodeChecksum(nodeVersion, platform, arch) { return undefined; } +function extractAlpinefromDocker(nodeVersion, platform, arch) { + const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node'; + log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`); + const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' }); + return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]); +} + const { nodeVersion, internalNodeVersion } = getNodeVersion(); BUILD_TARGETS.forEach(({ platform, arch }) => { @@ -219,18 +223,14 @@ function nodejs(platform, arch) { .pipe(filter('**/node')) .pipe(util.setExecutableBit('**')) .pipe(rename('node')); - case 'alpine': { - const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node'; - log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`); - const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' }); - if (checksumSha256) { - const actualSHA256Checksum = crypto.createHash('sha256').update(contents).digest('hex'); - if (actualSHA256Checksum !== checksumSha256) { - throw new Error(`Checksum mismatch for node.js from docker image (expected ${options.checksumSha256}, actual ${actualSHA256Checksum}))`); - } - } - return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]); - } + case 'alpine': + return product.nodejsRepository !== 'https://nodejs.org' ? + fetchGithub(product.nodejsRepository, { version: `${nodeVersion}-${internalNodeVersion}`, name: `node-v${nodeVersion}-${platform}-${arch}.tar.gz`, checksumSha256 }) + .pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar()))) + .pipe(filter('**/node')) + .pipe(util.setExecutableBit('**')) + .pipe(rename('node')) + : extractAlpinefromDocker(nodeVersion, platform, arch); } } diff --git a/package.json b/package.json index 861bebe2f9d..6352cb4a480 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.80.0", - "distro": "c2d5cc90ebce835fa01abe430b39d200a8417894", + "distro": "e741dbd03d4a6f9ac2093d4a173aa5e5c30411a5", "author": { "name": "Microsoft Corporation" }, diff --git a/remote/.yarnrc b/remote/.yarnrc index 9c86ae6bba4..29d716339bf 100644 --- a/remote/.yarnrc +++ b/remote/.yarnrc @@ -1,5 +1,5 @@ disturl "http://nodejs.org/dist" target "16.17.1" -ms_build_id "218982" +ms_build_id "220517" runtime "node" build_from_source "true"