diff --git a/build/azure-pipelines/linux/setup-env.sh b/build/azure-pipelines/linux/setup-env.sh index f0d5fe6..fdb3707 100755 --- a/build/azure-pipelines/linux/setup-env.sh +++ b/build/azure-pipelines/linux/setup-env.sh @@ -2,3 +2,3 @@ -set -e +set -ex @@ -22,3 +22,3 @@ else echo "Downloading remote sysroot" - SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" VSCODE_SYSROOT_PREFIX="-glibc-2.28-gcc-8.5.0" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()' + SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()' fi diff --git a/build/gulpfile.reh.ts b/build/gulpfile.reh.ts index 2714933..36396dc 100644 --- a/build/gulpfile.reh.ts +++ b/build/gulpfile.reh.ts @@ -235,9 +235,23 @@ function nodejs(platform: string, arch: string): NodeJS.ReadWriteStream | undefi case 'linux': - return (product.nodejsRepository !== 'https://nodejs.org' ? - fetchGithub(product.nodejsRepository, { version: `${nodeVersion}-${internalNodeVersion}`, name: expectedName!, checksumSha256 }) : - fetchUrls(`/dist/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.tar.gz`, { base: 'https://nodejs.org', checksumSha256 }) - ).pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar()))) - .pipe(filter('**/node')) - .pipe(util.setExecutableBit('**')) - .pipe(rename('node')); + if (process.env.VSCODE_NODEJS_SITE && process.env.VSCODE_NODEJS_URLROOT) { + return fetchUrls(`${process.env.VSCODE_NODEJS_URLROOT}/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}${process.env.VSCODE_NODEJS_URLSUFFIX}.tar.gz`, { base: process.env.VSCODE_NODEJS_SITE, checksumSha256 }) + .pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar()))) + .pipe(filter('**/node')) + .pipe(util.setExecutableBit('**')) + .pipe(rename('node')); + } + if (product.nodejsRepository !== 'https://nodejs.org') { + return fetchGithub(product.nodejsRepository, { version: `${nodeVersion}-${internalNodeVersion}`, name: expectedName!, checksumSha256 }) + .pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar()))) + .pipe(filter('**/node')) + .pipe(util.setExecutableBit('**')) + .pipe(rename('node')); + } + else { + return fetchUrls(`/dist/v${nodeVersion}/node-v${nodeVersion}-${platform}-${arch}.tar.gz`, { base: 'https://nodejs.org', checksumSha256 }) + .pipe(flatmap(stream => stream.pipe(gunzip()).pipe(untar()))) + .pipe(filter('**/node')) + .pipe(util.setExecutableBit('**')) + .pipe(rename('node')); + } case 'alpine': diff --git a/build/gulpfile.vscode.ts b/build/gulpfile.vscode.ts index 358bb3a..2cc6d9a 100644 --- a/build/gulpfile.vscode.ts +++ b/build/gulpfile.vscode.ts @@ -372,2 +372,12 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d + const electronOverride: { repo?: string; tag?: string } = {}; + if (process.env.VSCODE_ELECTRON_REPOSITORY) { + // official electron doesn't support all arch, override the repo with `VSCODE_ELECTRON_REPOSITORY`. + electronOverride.repo = process.env.VSCODE_ELECTRON_REPOSITORY; + } + + if (process.env.VSCODE_ELECTRON_TAG) { + electronOverride.tag = process.env.VSCODE_ELECTRON_TAG; + } + let result: NodeJS.ReadWriteStream = all @@ -376,3 +386,3 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d .pipe(filter(['**', '!**/.github/**'], { dot: true })) // https://github.com/microsoft/vscode/issues/116523 - .pipe(electron({ ...config, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false })) + .pipe(electron({ ...config, ...electronOverride, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false })) .pipe(filter(['**', '!LICENSE', '!version'], { dot: true })); diff --git a/build/linux/debian/dep-lists.ts b/build/linux/debian/dep-lists.ts index 46c257d..78bfb66 100644 --- a/build/linux/debian/dep-lists.ts +++ b/build/linux/debian/dep-lists.ts @@ -141,3 +141,3 @@ export const referenceGeneratedDepsByArch = { 'xdg-utils (>= 1.0.2)' - ] + ], }; diff --git a/build/linux/debian/install-sysroot.ts b/build/linux/debian/install-sysroot.ts index 2cab657..0d9dc55 100644 --- a/build/linux/debian/install-sysroot.ts +++ b/build/linux/debian/install-sysroot.ts @@ -82,3 +82,5 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000) try { - const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, { + const repository = process.env['VSCODE_SYSROOT_REPOSITORY'] ?? 'Microsoft/vscode-linux-build-agent'; + const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version; + const response = await fetch(`https://api.github.com/repos/${repository}/releases/tags/v${actualVersion}`, { headers: ghApiHeaders, @@ -91,3 +93,3 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000) if (!asset) { - throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`); + throw new Error(`Could not find asset in release of ${repository} @ ${actualVersion}`); }