Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/fixtures/codeMapper/product-build-linux.yml
13399 views
1
parameters:
2
- name: VSCODE_QUALITY
3
type: string
4
- name: VSCODE_ARCH
5
type: string
6
- name: VSCODE_CIBUILD
7
type: boolean
8
- name: VSCODE_RUN_ELECTRON_TESTS
9
type: boolean
10
default: false
11
- name: VSCODE_RUN_BROWSER_TESTS
12
type: boolean
13
default: false
14
- name: VSCODE_RUN_REMOTE_TESTS
15
type: boolean
16
default: false
17
- name: VSCODE_TEST_ARTIFACT_NAME
18
type: string
19
default: ""
20
21
steps:
22
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
23
- checkout: self
24
fetchDepth: 1
25
retryCountOnTaskFailure: 3
26
27
- task: NodeTool@0
28
inputs:
29
versionSource: fromFile
30
versionFilePath: .nvmrc
31
nodejsMirror: https://github.com/joaomoreno/node-mirror/releases/download
32
33
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
34
- template: ../distro/download-distro.yml@self
35
36
- task: AzureKeyVault@2
37
displayName: "Azure Key Vault: Get Secrets"
38
inputs:
39
azureSubscription: vscode
40
KeyVaultName: vscode-build-secrets
41
SecretsFilter: "github-distro-mixin-password"
42
43
- task: DownloadPipelineArtifact@2
44
inputs:
45
artifact: Compilation
46
path: $(Build.ArtifactStagingDirectory)
47
displayName: Download compilation output
48
49
- script: tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
50
displayName: Extract compilation output
51
52
- script: |
53
set -e
54
# Start X server
55
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
56
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
57
dbus \
58
xvfb \
59
libgtk-3-0 \
60
libxkbfile-dev \
61
libkrb5-dev \
62
libgbm1 \
63
rpm
64
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
65
sudo chmod +x /etc/init.d/xvfb
66
sudo update-rc.d xvfb defaults
67
sudo service xvfb start
68
# Start dbus session
69
sudo mkdir -p /var/run/dbus
70
DBUS_LAUNCH_RESULT=$(sudo dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address)
71
echo "##vso[task.setvariable variable=DBUS_SESSION_BUS_ADDRESS]$DBUS_LAUNCH_RESULT"
72
displayName: Setup system services
73
74
- script: node build/setup-npm-registry.js $NPM_REGISTRY
75
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
76
displayName: Setup NPM Registry
77
78
- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.js linux $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash
79
displayName: Prepare node_modules cache key
80
81
- task: Cache@2
82
inputs:
83
key: '"node_modules" | .build/packagelockhash'
84
path: .build/node_modules_cache
85
cacheHitVar: NODE_MODULES_RESTORED
86
displayName: Restore node_modules cache
87
88
- script: tar -xzf .build/node_modules_cache/cache.tgz
89
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
90
displayName: Extract node_modules cache
91
92
- script: |
93
set -e
94
# Set the private NPM registry to the global npmrc file
95
# so that authentication works for subfolders like build/, remote/, extensions/ etc
96
# which does not have their own .npmrc file
97
npm config set registry "$NPM_REGISTRY"
98
echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"
99
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
100
displayName: Setup NPM
101
102
- task: npmAuthenticate@0
103
inputs:
104
workingFile: $(NPMRC_PATH)
105
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
106
displayName: Setup NPM Authentication
107
108
- script: |
109
set -e
110
111
for i in {1..5}; do # try 5 times
112
npm ci && break
113
if [ $i -eq 5 ]; then
114
echo "Npm install failed too many times" >&2
115
exit 1
116
fi
117
echo "Npm install failed $i, trying again..."
118
done
119
workingDirectory: build
120
env:
121
GITHUB_TOKEN: "$(github-distro-mixin-password)"
122
displayName: Install build dependencies
123
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
124
125
# Step will be used by both Install dependencies and building rpm package,
126
# hence avoid adding it behind NODE_MODULES_RESTORED condition.
127
- script: |
128
set -e
129
SYSROOT_ARCH=$VSCODE_ARCH
130
if [ "$SYSROOT_ARCH" == "x64" ]; then
131
SYSROOT_ARCH="amd64"
132
fi
133
export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots
134
SYSROOT_ARCH="$SYSROOT_ARCH" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
135
env:
136
VSCODE_ARCH: $(VSCODE_ARCH)
137
GITHUB_TOKEN: "$(github-distro-mixin-password)"
138
displayName: Download vscode sysroots
139
140
- ${{ if or(eq(parameters.VSCODE_ARCH, 'arm64'), eq(parameters.VSCODE_ARCH, 'armhf')) }}:
141
- script: |
142
set -e
143
includes=$(cat << 'EOF'
144
{
145
"target_defaults": {
146
"conditions": [
147
["OS=='linux'", {
148
'cflags_cc!': [ '-std=gnu++20' ],
149
'cflags_cc': [ '-std=gnu++2a' ],
150
}]
151
]
152
}
153
}
154
EOF
155
)
156
if [ ! -d "$HOME/.gyp" ]; then
157
mkdir -p "$HOME/.gyp"
158
fi
159
echo "$includes" > "$HOME/.gyp/include.gypi"
160
displayName: Override gnu target for arm64 and arm
161
162
- script: |
163
set -e
164
165
source ./build/azure-pipelines/linux/setup-env.sh
166
167
for i in {1..5}; do # try 5 times
168
npm ci && break
169
if [ $i -eq 5 ]; then
170
echo "Npm install failed too many times" >&2
171
exit 1
172
fi
173
echo "Npm install failed $i, trying again..."
174
done
175
env:
176
npm_config_arch: $(NPM_ARCH)
177
VSCODE_ARCH: $(VSCODE_ARCH)
178
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
179
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
180
GITHUB_TOKEN: "$(github-distro-mixin-password)"
181
displayName: Install dependencies
182
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
183
184
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
185
- script: node build/azure-pipelines/distro/mixin-npm
186
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
187
displayName: Mixin distro node modules
188
189
- script: |
190
set -e
191
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
192
mkdir -p .build/node_modules_cache
193
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
194
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
195
displayName: Create node_modules archive
196
197
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
198
- script: node build/azure-pipelines/distro/mixin-quality
199
displayName: Mixin distro quality
200
201
- template: ../common/install-builtin-extensions.yml@self
202
203
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
204
- script: |
205
set -e
206
npm run gulp vscode-linux-$(VSCODE_ARCH)-min-ci
207
ARCHIVE_PATH=".build/linux/client/code-${{ parameters.VSCODE_QUALITY }}-$(VSCODE_ARCH)-$(date +%s).tar.gz"
208
mkdir -p $(dirname $ARCHIVE_PATH)
209
echo "##vso[task.setvariable variable=CLIENT_PATH]$ARCHIVE_PATH"
210
env:
211
GITHUB_TOKEN: "$(github-distro-mixin-password)"
212
displayName: Build client
213
214
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
215
- task: DownloadPipelineArtifact@2
216
inputs:
217
artifact: $(ARTIFACT_PREFIX)vscode_cli_linux_$(VSCODE_ARCH)_cli
218
patterns: "**"
219
path: $(Build.ArtifactStagingDirectory)/cli
220
displayName: Download VS Code CLI
221
222
- script: |
223
set -e
224
tar -xzvf $(Build.ArtifactStagingDirectory)/cli/*.tar.gz -C $(Build.ArtifactStagingDirectory)/cli
225
CLI_APP_NAME=$(node -p "require(\"$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)/resources/app/product.json\").tunnelApplicationName")
226
APP_NAME=$(node -p "require(\"$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)/resources/app/product.json\").applicationName")
227
mv $(Build.ArtifactStagingDirectory)/cli/$APP_NAME $(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)/bin/$CLI_APP_NAME
228
displayName: Mix in CLI
229
230
- script: |
231
set -e
232
tar -czf $CLIENT_PATH -C .. VSCode-linux-$(VSCODE_ARCH)
233
env:
234
GITHUB_TOKEN: "$(github-distro-mixin-password)"
235
displayName: Archive client
236
237
- script: |
238
set -e
239
npm run gulp vscode-reh-linux-$(VSCODE_ARCH)-min-ci
240
mv ../vscode-reh-linux-$(VSCODE_ARCH) ../vscode-server-linux-$(VSCODE_ARCH) # TODO@joaomoreno
241
ARCHIVE_PATH=".build/linux/server/vscode-server-linux-$(VSCODE_ARCH).tar.gz"
242
UNARCHIVE_PATH="`pwd`/../vscode-server-linux-$(VSCODE_ARCH)"
243
mkdir -p $(dirname $ARCHIVE_PATH)
244
tar --owner=0 --group=0 -czf $ARCHIVE_PATH -C .. vscode-server-linux-$(VSCODE_ARCH)
245
echo "##vso[task.setvariable variable=SERVER_PATH]$ARCHIVE_PATH"
246
echo "##vso[task.setvariable variable=SERVER_UNARCHIVE_PATH]$UNARCHIVE_PATH"
247
env:
248
GITHUB_TOKEN: "$(github-distro-mixin-password)"
249
displayName: Build server
250
251
- script: |
252
set -e
253
npm run gulp vscode-reh-web-linux-$(VSCODE_ARCH)-min-ci
254
mv ../vscode-reh-web-linux-$(VSCODE_ARCH) ../vscode-server-linux-$(VSCODE_ARCH)-web # TODO@joaomoreno
255
ARCHIVE_PATH=".build/linux/web/vscode-server-linux-$(VSCODE_ARCH)-web.tar.gz"
256
mkdir -p $(dirname $ARCHIVE_PATH)
257
tar --owner=0 --group=0 -czf $ARCHIVE_PATH -C .. vscode-server-linux-$(VSCODE_ARCH)-web
258
echo "##vso[task.setvariable variable=WEB_PATH]$ARCHIVE_PATH"
259
env:
260
GITHUB_TOKEN: "$(github-distro-mixin-password)"
261
displayName: Build server (web)
262
263
- ${{ if or(eq(parameters.VSCODE_ARCH, 'x64'), eq(parameters.VSCODE_ARCH, 'arm64')) }}:
264
- script: |
265
set -e
266
267
EXPECTED_GLIBC_VERSION="2.28" \
268
EXPECTED_GLIBCXX_VERSION="3.4.25" \
269
./build/azure-pipelines/linux/verify-glibc-requirements.sh
270
env:
271
SEARCH_PATH: $(SERVER_UNARCHIVE_PATH)
272
npm_config_arch: $(NPM_ARCH)
273
VSCODE_ARCH: $(VSCODE_ARCH)
274
displayName: Check GLIBC and GLIBCXX dependencies in server archive
275
276
- ${{ else }}:
277
- script: |
278
set -e
279
280
EXPECTED_GLIBC_VERSION="2.28" \
281
EXPECTED_GLIBCXX_VERSION="3.4.26" \
282
./build/azure-pipelines/linux/verify-glibc-requirements.sh
283
env:
284
SEARCH_PATH: $(SERVER_UNARCHIVE_PATH)
285
npm_config_arch: $(NPM_ARCH)
286
VSCODE_ARCH: $(VSCODE_ARCH)
287
displayName: Check GLIBC and GLIBCXX dependencies in server archive
288
289
- ${{ else }}:
290
- script: npm run gulp "transpile-client-esbuild" "transpile-extensions"
291
env:
292
GITHUB_TOKEN: "$(github-distro-mixin-password)"
293
displayName: Transpile client and extensions
294
295
- ${{ if or(eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true), eq(parameters.VSCODE_RUN_BROWSER_TESTS, true), eq(parameters.VSCODE_RUN_REMOTE_TESTS, true)) }}:
296
- template: product-build-linux-test.yml@self
297
parameters:
298
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
299
VSCODE_RUN_ELECTRON_TESTS: ${{ parameters.VSCODE_RUN_ELECTRON_TESTS }}
300
VSCODE_RUN_BROWSER_TESTS: ${{ parameters.VSCODE_RUN_BROWSER_TESTS }}
301
VSCODE_RUN_REMOTE_TESTS: ${{ parameters.VSCODE_RUN_REMOTE_TESTS }}
302
VSCODE_TEST_ARTIFACT_NAME: ${{ parameters.VSCODE_TEST_ARTIFACT_NAME }}
303
${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
304
PUBLISH_TASK_NAME: 1ES.PublishPipelineArtifact@1
305
306
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
307
- script: |
308
set -e
309
npm run gulp "vscode-linux-$(VSCODE_ARCH)-prepare-deb"
310
env:
311
GITHUB_TOKEN: "$(github-distro-mixin-password)"
312
displayName: Prepare deb package
313
314
- script: |
315
set -e
316
npm run gulp "vscode-linux-$(VSCODE_ARCH)-build-deb"
317
file_output=$(file $(ls .build/linux/deb/*/deb/*.deb))
318
if [[ "$file_output" != *"data compression xz"* ]]; then
319
echo "Error: unknown compression. $file_output"
320
exit 1
321
fi
322
echo "##vso[task.setvariable variable=DEB_PATH]$(ls .build/linux/deb/*/deb/*.deb)"
323
displayName: Build deb package
324
325
- script: |
326
set -e
327
TRIPLE=""
328
if [ "$VSCODE_ARCH" == "x64" ]; then
329
TRIPLE="x86_64-linux-gnu"
330
elif [ "$VSCODE_ARCH" == "arm64" ]; then
331
TRIPLE="aarch64-linux-gnu"
332
elif [ "$VSCODE_ARCH" == "armhf" ]; then
333
TRIPLE="arm-rpi-linux-gnueabihf"
334
fi
335
export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots
336
export STRIP="$VSCODE_SYSROOT_DIR/$TRIPLE/$TRIPLE/bin/strip"
337
npm run gulp "vscode-linux-$(VSCODE_ARCH)-prepare-rpm"
338
env:
339
VSCODE_ARCH: $(VSCODE_ARCH)
340
displayName: Prepare rpm package
341
342
- script: |
343
set -e
344
npm run gulp "vscode-linux-$(VSCODE_ARCH)-build-rpm"
345
echo "##vso[task.setvariable variable=RPM_PATH]$(ls .build/linux/rpm/*/*.rpm)"
346
displayName: Build rpm package
347
348
- task: Docker@1
349
inputs:
350
azureSubscriptionEndpoint: vscode
351
azureContainerRegistry: vscodehub.azurecr.io
352
command: Run an image
353
imageName: vscodehub.azurecr.io/vscode-linux-build-agent:snapcraft-x64
354
containerCommand: uname
355
displayName: Pull snap build image
356
357
- script: |
358
set -e
359
npm run gulp "vscode-linux-$(VSCODE_ARCH)-prepare-snap"
360
361
362
363
364
# Get snapcraft version
365
snapcraft --version
366
367
# Make sure we get latest packages
368
sudo apt-get update
369
sudo apt-get upgrade -y
370
sudo apt-get install -y curl apt-transport-https ca-certificates
371
372
# Define variables
373
SNAP_ROOT="$(pwd)/.build/linux/snap/$(VSCODE_ARCH)"
374
375
# Unpack snap tarball artifact, in order to preserve file perms
376
(cd .build/linux && tar -xzf snap-tarball/snap-$(VSCODE_ARCH).tar.gz)
377
378
# Create snap package
379
BUILD_VERSION="$(date +%s)"
380
SNAP_FILENAME="code-$VSCODE_QUALITY-$(VSCODE_ARCH)-$BUILD_VERSION.snap"
381
SNAP_PATH="$SNAP_ROOT/$SNAP_FILENAME"
382
case $(VSCODE_ARCH) in
383
x64) SNAPCRAFT_TARGET_ARGS="" ;;
384
*) SNAPCRAFT_TARGET_ARGS="--target-arch $(VSCODE_ARCH)" ;;
385
esac
386
(cd $SNAP_ROOT/code-* && sudo --preserve-env snapcraft snap $SNAPCRAFT_TARGET_ARGS --output "$SNAP_PATH")
387
388
389
390
391
392
echo "##vso[task.setvariable variable=SNAP_PATH]$ARCHIVE_PATH"
393
displayName: Build snap package
394
395
- task: UseDotNet@2
396
inputs:
397
version: 6.x
398
399
- task: EsrpCodeSigning@5
400
inputs:
401
UseMSIAuthentication: true
402
ConnectedServiceName: vscode-esrp
403
AppRegistrationClientId: $(ESRP_CLIENT_ID)
404
AppRegistrationTenantId: $(ESRP_TENANT_ID)
405
AuthAKVName: vscode-esrp
406
AuthSignCertName: esrp-sign
407
FolderPath: .
408
Pattern: noop
409
displayName: 'Install ESRP Tooling'
410
411
- script: node build/azure-pipelines/common/sign $(Agent.RootDirectory)/_tasks/EsrpCodeSigning_*/*/net6.0/esrpcli.dll sign-pgp .build/linux/deb '*.deb'
412
env:
413
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
414
displayName: Codesign deb
415
416
- script: node build/azure-pipelines/common/sign $(Agent.RootDirectory)/_tasks/EsrpCodeSigning_*/*/net6.0/esrpcli.dll sign-pgp .build/linux/rpm '*.rpm'
417
env:
418
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
419
displayName: Codesign rpm
420
421
- script: echo "##vso[task.setvariable variable=ARTIFACT_PREFIX]attempt$(System.JobAttempt)_"
422
condition: and(succeededOrFailed(), notIn(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'))
423
displayName: Generate artifact prefix
424
425
- task: 1ES.PublishPipelineArtifact@1
426
inputs:
427
targetPath: $(CLIENT_PATH)
428
artifactName: $(ARTIFACT_PREFIX)vscode_client_linux_$(VSCODE_ARCH)_archive-unsigned
429
sbomBuildDropPath: $(Agent.BuildDirectory)/VSCode-linux-$(VSCODE_ARCH)
430
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) (unsigned)"
431
sbomPackageVersion: $(Build.SourceVersion)
432
condition: and(succeededOrFailed(), ne(variables['CLIENT_PATH'], ''))
433
displayName: Publish client archive
434
435
- task: 1ES.PublishPipelineArtifact@1
436
inputs:
437
targetPath: $(SERVER_PATH)
438
artifactName: $(ARTIFACT_PREFIX)vscode_server_linux_$(VSCODE_ARCH)_archive-unsigned
439
sbomBuildDropPath: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH)
440
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) Server"
441
sbomPackageVersion: $(Build.SourceVersion)
442
condition: and(succeededOrFailed(), ne(variables['SERVER_PATH'], ''))
443
displayName: Publish server archive
444
445
- task: 1ES.PublishPipelineArtifact@1
446
inputs:
447
targetPath: $(WEB_PATH)
448
artifactName: $(ARTIFACT_PREFIX)vscode_web_linux_$(VSCODE_ARCH)_archive-unsigned
449
sbomBuildDropPath: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH)-web
450
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) Web"
451
sbomPackageVersion: $(Build.SourceVersion)
452
condition: and(succeededOrFailed(), ne(variables['WEB_PATH'], ''))
453
displayName: Publish web server archive
454
455
- task: 1ES.PublishPipelineArtifact@1
456
inputs:
457
targetPath: $(DEB_PATH)
458
artifactName: $(ARTIFACT_PREFIX)vscode_client_linux_$(VSCODE_ARCH)_deb-package
459
sbomBuildDropPath: .build/linux/deb
460
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) DEB"
461
sbomPackageVersion: $(Build.SourceVersion)
462
condition: and(succeededOrFailed(), ne(variables['DEB_PATH'], ''))
463
displayName: Publish deb package
464
465
- task: 1ES.PublishPipelineArtifact@1
466
inputs:
467
targetPath: $(RPM_PATH)
468
artifactName: $(ARTIFACT_PREFIX)vscode_client_linux_$(VSCODE_ARCH)_rpm-package
469
sbomBuildDropPath: .build/linux/rpm
470
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) RPM"
471
sbomPackageVersion: $(Build.SourceVersion)
472
condition: and(succeededOrFailed(), ne(variables['RPM_PATH'], ''))
473
displayName: Publish rpm package
474
475
- task: 1ES.PublishPipelineArtifact@1
476
inputs:
477
targetPath: $(SNAP_PATH)
478
artifactName: vscode_client_linux_$(VSCODE_ARCH)_snap
479
sbomBuildDropPath: $(SNAP_EXTRACTED_PATH)
480
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) SNAP"
481
sbomPackageVersion: $(Build.SourceVersion)
482
condition: and(succeededOrFailed(), ne(variables['SNAP_PATH'], ''))
483
displayName: Publish snap package
484