Path: blob/main/build/azure-pipelines/linux/product-build-linux-node-modules.yml
4772 views
parameters:1- name: NPM_ARCH2type: string3- name: VSCODE_ARCH4type: string56jobs:7- job: LinuxNodeModules_${{ parameters.VSCODE_ARCH }}8displayName: Linux (${{ upper(parameters.VSCODE_ARCH) }})9pool:10name: 1es-ubuntu-22.04-x6411os: linux12timeoutInMinutes: 6013variables:14NPM_ARCH: ${{ parameters.NPM_ARCH }}15VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}16steps:17- template: ../common/checkout.yml@self1819- task: NodeTool@020inputs:21versionSource: fromFile22versionFilePath: .nvmrc2324- template: ../distro/download-distro.yml@self2526- task: AzureKeyVault@227displayName: "Azure Key Vault: Get Secrets"28inputs:29azureSubscription: vscode30KeyVaultName: vscode-build-secrets31SecretsFilter: "github-distro-mixin-password"3233- script: |34set -e35# Start X server36./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update37./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \38xvfb \39libgtk-3-0 \40libxkbfile-dev \41libkrb5-dev \42libgbm1 \43rpm44sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb45sudo chmod +x /etc/init.d/xvfb46sudo update-rc.d xvfb defaults47sudo service xvfb start48displayName: Setup system services4950- script: node build/setup-npm-registry.ts $NPM_REGISTRY51condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))52displayName: Setup NPM Registry5354- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts linux $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash55displayName: Prepare node_modules cache key5657- task: Cache@258inputs:59key: '"node_modules" | .build/packagelockhash'60path: .build/node_modules_cache61cacheHitVar: NODE_MODULES_RESTORED62displayName: Restore node_modules cache6364- script: |65set -e66# Set the private NPM registry to the global npmrc file67# so that authentication works for subfolders like build/, remote/, extensions/ etc68# which does not have their own .npmrc file69npm config set registry "$NPM_REGISTRY"70echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"71condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))72displayName: Setup NPM7374- task: npmAuthenticate@075inputs:76workingFile: $(NPMRC_PATH)77condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))78displayName: Setup NPM Authentication7980- script: |81set -e8283for i in {1..5}; do # try 5 times84npm ci && break85if [ $i -eq 5 ]; then86echo "Npm install failed too many times" >&287exit 188fi89echo "Npm install failed $i, trying again..."90done91workingDirectory: build92env:93GITHUB_TOKEN: "$(github-distro-mixin-password)"94displayName: Install build dependencies95condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))9697# Step will be used by both verify glibcxx version for remote server and building rpm package,98# hence avoid adding it behind NODE_MODULES_RESTORED condition.99- script: |100set -e101SYSROOT_ARCH=$VSCODE_ARCH102if [ "$SYSROOT_ARCH" == "x64" ]; then103SYSROOT_ARCH="amd64"104fi105export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots/glibc-2.28-gcc-8.5.0106SYSROOT_ARCH="$SYSROOT_ARCH" 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"]); })()'107env:108VSCODE_ARCH: $(VSCODE_ARCH)109GITHUB_TOKEN: "$(github-distro-mixin-password)"110displayName: Download vscode sysroots111condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))112113- script: |114set -e115116source ./build/azure-pipelines/linux/setup-env.sh117118# Run preinstall script before root dependencies are installed119# so that v8 headers are patched correctly for native modules.120node build/npm/preinstall.ts121122for i in {1..5}; do # try 5 times123npm ci && break124if [ $i -eq 5 ]; then125echo "Npm install failed too many times" >&2126exit 1127fi128echo "Npm install failed $i, trying again..."129done130env:131npm_config_arch: $(NPM_ARCH)132VSCODE_ARCH: $(VSCODE_ARCH)133ELECTRON_SKIP_BINARY_DOWNLOAD: 1134PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1135GITHUB_TOKEN: "$(github-distro-mixin-password)"136displayName: Install dependencies137condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))138139- script: node build/azure-pipelines/distro/mixin-npm.ts140condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))141displayName: Mixin distro node modules142143- script: |144set -e145node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt146mkdir -p .build/node_modules_cache147tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt148condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))149displayName: Create node_modules archive150151152