Path: blob/main/build/azure-pipelines/darwin/product-build-darwin-node-modules.yml
5362 views
parameters:1- name: VSCODE_ARCH2type: string34jobs:5- job: macOSNodeModules_${{ parameters.VSCODE_ARCH }}6displayName: macOS (${{ upper(parameters.VSCODE_ARCH) }})7pool:8name: AcesShared9os: macOS10demands:11- ImageOverride -equals ACES_VM_SharedPool_Sequoia12timeoutInMinutes: 6013variables:14VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}15steps:16- template: ../common/checkout.yml@self1718- task: NodeTool@019inputs:20versionSource: fromFile21versionFilePath: .nvmrc2223- template: ../distro/download-distro.yml@self2425- task: AzureKeyVault@226displayName: "Azure Key Vault: Get Secrets"27inputs:28azureSubscription: vscode29KeyVaultName: vscode-build-secrets30SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"3132- script: node build/setup-npm-registry.ts $NPM_REGISTRY33condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))34displayName: Setup NPM Registry3536- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash37displayName: Prepare node_modules cache key3839- task: Cache@240inputs:41key: '"node_modules" | .build/packagelockhash'42path: .build/node_modules_cache43cacheHitVar: NODE_MODULES_RESTORED44displayName: Restore node_modules cache4546- script: |47set -e48# Set the private NPM registry to the global npmrc file49# so that authentication works for subfolders like build/, remote/, extensions/ etc50# which does not have their own .npmrc file51npm config set registry "$NPM_REGISTRY"52echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"53condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))54displayName: Setup NPM5556- task: npmAuthenticate@057inputs:58workingFile: $(NPMRC_PATH)59condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))60displayName: Setup NPM Authentication6162- script: |63set -e64c++ --version65xcode-select -print-path66python3 -m pip install setuptools6768for i in {1..5}; do # try 5 times69npm ci && break70if [ $i -eq 5 ]; then71echo "Npm install failed too many times" >&272exit 173fi74echo "Npm install failed $i, trying again..."75done76env:77npm_config_arch: $(VSCODE_ARCH)78ELECTRON_SKIP_BINARY_DOWNLOAD: 179PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 180GITHUB_TOKEN: "$(github-distro-mixin-password)"81# Avoid using dlopen to load Kerberos on macOS which can cause missing libraries82# https://github.com/mongodb-js/kerberos/commit/04044d2814ad1d01e77f1ce87f26b03d86692cf283# flipped the default to support legacy linux distros which shouldn't happen84# on macOS.85GYP_DEFINES: "kerberos_use_rtld=false"86displayName: Install dependencies87condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))8889- script: node build/azure-pipelines/distro/mixin-npm.ts90condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))91displayName: Mixin distro node modules9293- script: |94set -e95node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt96mkdir -p .build/node_modules_cache97tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt98condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))99displayName: Create node_modules archive100101102