Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/alpine/product-build-alpine.yml
5379 views
1
parameters:
2
- name: VSCODE_ARCH
3
type: string
4
5
jobs:
6
- job: Alpine_${{ parameters.VSCODE_ARCH }}
7
displayName: Alpine (${{ upper(parameters.VSCODE_ARCH) }})
8
timeoutInMinutes: 30
9
pool:
10
name: 1es-ubuntu-22.04-x64
11
os: linux
12
variables:
13
NPM_ARCH: ${{ parameters.VSCODE_ARCH }}
14
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
15
templateContext:
16
outputParentDirectory: $(Build.ArtifactStagingDirectory)/out
17
outputs:
18
- ${{ if eq(parameters.VSCODE_ARCH, 'x64') }}:
19
# keep legacy name
20
- output: pipelineArtifact
21
targetPath: $(Build.ArtifactStagingDirectory)/out/server/vscode-server-linux-alpine.tar.gz
22
artifactName: vscode_server_linux_alpine_archive-unsigned
23
displayName: Publish x64 server archive
24
sbomBuildDropPath: $(SERVER_DIR_PATH)
25
sbomPackageName: "VS Code Alpine x64 Server"
26
sbomPackageVersion: $(Build.SourceVersion)
27
# keep legacy name
28
- output: pipelineArtifact
29
targetPath: $(Build.ArtifactStagingDirectory)/out/web/vscode-server-linux-alpine-web.tar.gz
30
artifactName: vscode_web_linux_alpine_archive-unsigned
31
displayName: Publish x64 web server archive
32
sbomBuildDropPath: $(WEB_DIR_PATH)
33
sbomPackageName: "VS Code Alpine x64 Web"
34
sbomPackageVersion: $(Build.SourceVersion)
35
- ${{ if ne(parameters.VSCODE_ARCH, 'x64') }}:
36
- output: pipelineArtifact
37
targetPath: $(Build.ArtifactStagingDirectory)/out/server/vscode-server-alpine-$(VSCODE_ARCH).tar.gz
38
artifactName: vscode_server_alpine_$(VSCODE_ARCH)_archive-unsigned
39
displayName: Publish server archive
40
sbomBuildDropPath: $(SERVER_DIR_PATH)
41
sbomPackageName: "VS Code Alpine $(VSCODE_ARCH) Server"
42
sbomPackageVersion: $(Build.SourceVersion)
43
- output: pipelineArtifact
44
targetPath: $(Build.ArtifactStagingDirectory)/out/web/vscode-server-alpine-$(VSCODE_ARCH)-web.tar.gz
45
artifactName: vscode_web_alpine_$(VSCODE_ARCH)_archive-unsigned
46
displayName: Publish web server archive
47
sbomBuildDropPath: $(WEB_DIR_PATH)
48
sbomPackageName: "VS Code Alpine $(VSCODE_ARCH) Web"
49
sbomPackageVersion: $(Build.SourceVersion)
50
steps:
51
- template: ../common/checkout.yml@self
52
53
- task: NodeTool@0
54
inputs:
55
versionSource: fromFile
56
versionFilePath: .nvmrc
57
58
- template: ../distro/download-distro.yml@self
59
60
- task: AzureKeyVault@2
61
displayName: "Azure Key Vault: Get Secrets"
62
inputs:
63
azureSubscription: vscode
64
KeyVaultName: vscode-build-secrets
65
SecretsFilter: "github-distro-mixin-password"
66
67
- task: DownloadPipelineArtifact@2
68
inputs:
69
artifact: Compilation
70
path: $(Build.ArtifactStagingDirectory)
71
displayName: Download compilation output
72
73
- script: tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
74
displayName: Extract compilation output
75
76
- script: node build/setup-npm-registry.ts $NPM_REGISTRY
77
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
78
displayName: Setup NPM Registry
79
80
- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts alpine $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash
81
displayName: Prepare node_modules cache key
82
83
- task: Cache@2
84
inputs:
85
key: '"node_modules" | .build/packagelockhash'
86
path: .build/node_modules_cache
87
cacheHitVar: NODE_MODULES_RESTORED
88
displayName: Restore node_modules cache
89
90
- script: tar -xzf .build/node_modules_cache/cache.tgz
91
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
92
displayName: Extract node_modules cache
93
94
- script: |
95
set -e
96
# Set the private NPM registry to the global npmrc file
97
# so that authentication works for subfolders like build/, remote/, extensions/ etc
98
# which does not have their own .npmrc file
99
npm config set registry "$NPM_REGISTRY"
100
echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"
101
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
102
displayName: Setup NPM
103
104
- task: npmAuthenticate@0
105
inputs:
106
workingFile: $(NPMRC_PATH)
107
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
108
displayName: Setup NPM Authentication
109
110
- task: Docker@1
111
inputs:
112
azureSubscriptionEndpoint: vscode
113
azureContainerRegistry: vscodehub.azurecr.io
114
command: "Run an image"
115
imageName: "vscode-linux-build-agent:alpine-$(VSCODE_ARCH)"
116
containerCommand: uname
117
displayName: "Pull image"
118
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
119
120
- script: sudo apt-get update && sudo apt-get install -y libkrb5-dev
121
displayName: Install build dependencies
122
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
123
124
- script: |
125
set -e
126
mkdir -p .build/nodejs-musl
127
NODE_VERSION=$(grep '^target=' remote/.npmrc | cut -d '"' -f 2)
128
BUILD_ID=$(grep '^ms_build_id=' remote/.npmrc | cut -d '"' -f 2)
129
gh release download "v${NODE_VERSION}-${BUILD_ID}" -R microsoft/vscode-node -p "node-v${NODE_VERSION}-linux-${VSCODE_ARCH}-musl.tar.gz" --dir .build/nodejs-musl --clobber
130
tar -xzf ".build/nodejs-musl/node-v${NODE_VERSION}-linux-${VSCODE_ARCH}-musl.tar.gz" -C ".build/nodejs-musl" --strip-components=1
131
rm ".build/nodejs-musl/node-v${NODE_VERSION}-linux-${VSCODE_ARCH}-musl.tar.gz"
132
env:
133
GITHUB_TOKEN: "$(github-distro-mixin-password)"
134
displayName: Download NodeJS MUSL
135
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
136
137
- script: |
138
set -e
139
140
for i in {1..5}; do # try 5 times
141
npm ci && break
142
if [ $i -eq 5 ]; then
143
echo "Npm install failed too many times" >&2
144
exit 1
145
fi
146
echo "Npm install failed $i, trying again..."
147
done
148
env:
149
npm_config_arch: $(NPM_ARCH)
150
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
151
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
152
GITHUB_TOKEN: "$(github-distro-mixin-password)"
153
VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME: vscodehub.azurecr.io/vscode-linux-build-agent:alpine-$(VSCODE_ARCH)
154
VSCODE_HOST_MOUNT: "/mnt/vss/_work/1/s"
155
VSCODE_NPMRC_PATH: $(NPMRC_PATH)
156
displayName: Install dependencies
157
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
158
159
- script: node build/azure-pipelines/distro/mixin-npm.ts
160
displayName: Mixin distro node modules
161
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
162
163
- script: |
164
set -e
165
node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt
166
mkdir -p .build/node_modules_cache
167
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
168
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
169
displayName: Create node_modules archive
170
171
- script: node build/azure-pipelines/distro/mixin-quality.ts
172
displayName: Mixin distro quality
173
174
- template: ../common/install-builtin-extensions.yml@self
175
176
- script: |
177
set -e
178
TARGET=$([ "$VSCODE_ARCH" == "x64" ] && echo "linux-alpine" || echo "alpine-arm64") # TODO@joaomoreno
179
npm run gulp vscode-reh-$TARGET-min-ci
180
(cd .. && mv vscode-reh-$TARGET vscode-server-$TARGET) # TODO@joaomoreno
181
ARCHIVE_PATH="$(Build.ArtifactStagingDirectory)/out/server/vscode-server-$TARGET.tar.gz"
182
DIR_PATH="$(realpath ../vscode-server-$TARGET)"
183
mkdir -p $(dirname $ARCHIVE_PATH)
184
tar --owner=0 --group=0 -czf $ARCHIVE_PATH -C .. vscode-server-$TARGET
185
echo "##vso[task.setvariable variable=SERVER_DIR_PATH]$DIR_PATH"
186
echo "##vso[task.setvariable variable=SERVER_PATH]$ARCHIVE_PATH"
187
env:
188
GITHUB_TOKEN: "$(github-distro-mixin-password)"
189
displayName: Build server
190
191
- script: |
192
set -e
193
TARGET=$([ "$VSCODE_ARCH" == "x64" ] && echo "linux-alpine" || echo "alpine-arm64")
194
npm run gulp vscode-reh-web-$TARGET-min-ci
195
(cd .. && mv vscode-reh-web-$TARGET vscode-server-$TARGET-web) # TODO@joaomoreno
196
ARCHIVE_PATH="$(Build.ArtifactStagingDirectory)/out/web/vscode-server-$TARGET-web.tar.gz"
197
DIR_PATH="$(realpath ../vscode-server-$TARGET-web)"
198
mkdir -p $(dirname $ARCHIVE_PATH)
199
tar --owner=0 --group=0 -czf $ARCHIVE_PATH -C .. vscode-server-$TARGET-web
200
echo "##vso[task.setvariable variable=WEB_DIR_PATH]$DIR_PATH"
201
echo "##vso[task.setvariable variable=WEB_PATH]$ARCHIVE_PATH"
202
env:
203
GITHUB_TOKEN: "$(github-distro-mixin-password)"
204
displayName: Build server (web)
205
206