Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/linux/product-build-linux-node-modules.yml
4772 views
1
parameters:
2
- name: NPM_ARCH
3
type: string
4
- name: VSCODE_ARCH
5
type: string
6
7
jobs:
8
- job: LinuxNodeModules_${{ parameters.VSCODE_ARCH }}
9
displayName: Linux (${{ upper(parameters.VSCODE_ARCH) }})
10
pool:
11
name: 1es-ubuntu-22.04-x64
12
os: linux
13
timeoutInMinutes: 60
14
variables:
15
NPM_ARCH: ${{ parameters.NPM_ARCH }}
16
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
17
steps:
18
- template: ../common/checkout.yml@self
19
20
- task: NodeTool@0
21
inputs:
22
versionSource: fromFile
23
versionFilePath: .nvmrc
24
25
- template: ../distro/download-distro.yml@self
26
27
- task: AzureKeyVault@2
28
displayName: "Azure Key Vault: Get Secrets"
29
inputs:
30
azureSubscription: vscode
31
KeyVaultName: vscode-build-secrets
32
SecretsFilter: "github-distro-mixin-password"
33
34
- script: |
35
set -e
36
# Start X server
37
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
38
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
39
xvfb \
40
libgtk-3-0 \
41
libxkbfile-dev \
42
libkrb5-dev \
43
libgbm1 \
44
rpm
45
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
46
sudo chmod +x /etc/init.d/xvfb
47
sudo update-rc.d xvfb defaults
48
sudo service xvfb start
49
displayName: Setup system services
50
51
- script: node build/setup-npm-registry.ts $NPM_REGISTRY
52
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
53
displayName: Setup NPM Registry
54
55
- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts linux $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash
56
displayName: Prepare node_modules cache key
57
58
- task: Cache@2
59
inputs:
60
key: '"node_modules" | .build/packagelockhash'
61
path: .build/node_modules_cache
62
cacheHitVar: NODE_MODULES_RESTORED
63
displayName: Restore node_modules cache
64
65
- script: |
66
set -e
67
# Set the private NPM registry to the global npmrc file
68
# so that authentication works for subfolders like build/, remote/, extensions/ etc
69
# which does not have their own .npmrc file
70
npm config set registry "$NPM_REGISTRY"
71
echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"
72
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
73
displayName: Setup NPM
74
75
- task: npmAuthenticate@0
76
inputs:
77
workingFile: $(NPMRC_PATH)
78
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
79
displayName: Setup NPM Authentication
80
81
- script: |
82
set -e
83
84
for i in {1..5}; do # try 5 times
85
npm ci && break
86
if [ $i -eq 5 ]; then
87
echo "Npm install failed too many times" >&2
88
exit 1
89
fi
90
echo "Npm install failed $i, trying again..."
91
done
92
workingDirectory: build
93
env:
94
GITHUB_TOKEN: "$(github-distro-mixin-password)"
95
displayName: Install build dependencies
96
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
97
98
# Step will be used by both verify glibcxx version for remote server and building rpm package,
99
# hence avoid adding it behind NODE_MODULES_RESTORED condition.
100
- script: |
101
set -e
102
SYSROOT_ARCH=$VSCODE_ARCH
103
if [ "$SYSROOT_ARCH" == "x64" ]; then
104
SYSROOT_ARCH="amd64"
105
fi
106
export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots/glibc-2.28-gcc-8.5.0
107
SYSROOT_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"]); })()'
108
env:
109
VSCODE_ARCH: $(VSCODE_ARCH)
110
GITHUB_TOKEN: "$(github-distro-mixin-password)"
111
displayName: Download vscode sysroots
112
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
113
114
- script: |
115
set -e
116
117
source ./build/azure-pipelines/linux/setup-env.sh
118
119
# Run preinstall script before root dependencies are installed
120
# so that v8 headers are patched correctly for native modules.
121
node build/npm/preinstall.ts
122
123
for i in {1..5}; do # try 5 times
124
npm ci && break
125
if [ $i -eq 5 ]; then
126
echo "Npm install failed too many times" >&2
127
exit 1
128
fi
129
echo "Npm install failed $i, trying again..."
130
done
131
env:
132
npm_config_arch: $(NPM_ARCH)
133
VSCODE_ARCH: $(VSCODE_ARCH)
134
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
135
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
136
GITHUB_TOKEN: "$(github-distro-mixin-password)"
137
displayName: Install dependencies
138
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
139
140
- script: node build/azure-pipelines/distro/mixin-npm.ts
141
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
142
displayName: Mixin distro node modules
143
144
- script: |
145
set -e
146
node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt
147
mkdir -p .build/node_modules_cache
148
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
149
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
150
displayName: Create node_modules archive
151
152