Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/web/product-build-web-node-modules.yml
4772 views
1
jobs:
2
- job: WebNodeModules
3
displayName: Web
4
pool:
5
name: 1es-ubuntu-22.04-x64
6
os: linux
7
timeoutInMinutes: 60
8
steps:
9
- template: ../common/checkout.yml@self
10
11
- task: NodeTool@0
12
inputs:
13
versionSource: fromFile
14
versionFilePath: .nvmrc
15
16
- template: ../distro/download-distro.yml@self
17
18
- task: AzureKeyVault@2
19
displayName: "Azure Key Vault: Get Secrets"
20
inputs:
21
azureSubscription: vscode
22
KeyVaultName: vscode-build-secrets
23
SecretsFilter: "github-distro-mixin-password"
24
25
- script: node build/setup-npm-registry.ts $NPM_REGISTRY
26
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
27
displayName: Setup NPM Registry
28
29
- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts web $(node -p process.arch) > .build/packagelockhash
30
displayName: Prepare node_modules cache key
31
32
- task: Cache@2
33
inputs:
34
key: '"node_modules" | .build/packagelockhash'
35
path: .build/node_modules_cache
36
cacheHitVar: NODE_MODULES_RESTORED
37
displayName: Restore node_modules cache
38
39
- script: |
40
set -e
41
# Set the private NPM registry to the global npmrc file
42
# so that authentication works for subfolders like build/, remote/, extensions/ etc
43
# which does not have their own .npmrc file
44
npm config set registry "$NPM_REGISTRY"
45
echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"
46
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
47
displayName: Setup NPM
48
49
- task: npmAuthenticate@0
50
inputs:
51
workingFile: $(NPMRC_PATH)
52
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
53
displayName: Setup NPM Authentication
54
55
- script: |
56
set -e
57
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
58
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libkrb5-dev
59
displayName: Setup system services
60
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
61
62
- script: |
63
set -e
64
65
for i in {1..5}; do # try 5 times
66
npm ci && break
67
if [ $i -eq 5 ]; then
68
echo "Npm install failed too many times" >&2
69
exit 1
70
fi
71
echo "Npm install failed $i, trying again..."
72
done
73
env:
74
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
75
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
76
GITHUB_TOKEN: "$(github-distro-mixin-password)"
77
displayName: Install dependencies
78
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
79
80
- script: node build/azure-pipelines/distro/mixin-npm.ts
81
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
82
displayName: Mixin distro node modules
83
84
- script: |
85
set -e
86
node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt
87
mkdir -p .build/node_modules_cache
88
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
89
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
90
displayName: Create node_modules archive
91
92