Path: blob/main/build/azure-pipelines/web/product-build-web-node-modules.yml
4772 views
jobs:1- job: WebNodeModules2displayName: Web3pool:4name: 1es-ubuntu-22.04-x645os: linux6timeoutInMinutes: 607steps:8- template: ../common/checkout.yml@self910- task: NodeTool@011inputs:12versionSource: fromFile13versionFilePath: .nvmrc1415- template: ../distro/download-distro.yml@self1617- task: AzureKeyVault@218displayName: "Azure Key Vault: Get Secrets"19inputs:20azureSubscription: vscode21KeyVaultName: vscode-build-secrets22SecretsFilter: "github-distro-mixin-password"2324- script: node build/setup-npm-registry.ts $NPM_REGISTRY25condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))26displayName: Setup NPM Registry2728- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts web $(node -p process.arch) > .build/packagelockhash29displayName: Prepare node_modules cache key3031- task: Cache@232inputs:33key: '"node_modules" | .build/packagelockhash'34path: .build/node_modules_cache35cacheHitVar: NODE_MODULES_RESTORED36displayName: Restore node_modules cache3738- script: |39set -e40# Set the private NPM registry to the global npmrc file41# so that authentication works for subfolders like build/, remote/, extensions/ etc42# which does not have their own .npmrc file43npm config set registry "$NPM_REGISTRY"44echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"45condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))46displayName: Setup NPM4748- task: npmAuthenticate@049inputs:50workingFile: $(NPMRC_PATH)51condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))52displayName: Setup NPM Authentication5354- script: |55set -e56./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update57./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libkrb5-dev58displayName: Setup system services59condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))6061- script: |62set -e6364for i in {1..5}; do # try 5 times65npm ci && break66if [ $i -eq 5 ]; then67echo "Npm install failed too many times" >&268exit 169fi70echo "Npm install failed $i, trying again..."71done72env:73ELECTRON_SKIP_BINARY_DOWNLOAD: 174PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 175GITHUB_TOKEN: "$(github-distro-mixin-password)"76displayName: Install dependencies77condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))7879- script: node build/azure-pipelines/distro/mixin-npm.ts80condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))81displayName: Mixin distro node modules8283- script: |84set -e85node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt86mkdir -p .build/node_modules_cache87tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt88condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))89displayName: Create node_modules archive909192