Skip to content

Commit fb77ec5

Browse files
committed
fixup! Add a build definition for Azure DevOps
In Azure Pipelines, a sane setting is to prevent secret variables from being shared with Pull Requests originating from forks. In Git, we use such a secret variable: we want to mount a file share on which previous we store outcomes of previous runs, and avoid re-running known-good phases (both for speed as well as to avoid spending resources unnecessarily). This file share should not be mounted in PRs. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 1e6a1c5 commit fb77ec5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

azure-pipelines.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ phases:
1010
name: Hosted Ubuntu 1604
1111
steps:
1212
- bash: |
13-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
13+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
1414
1515
sudo apt-get update &&
1616
sudo rm /var/lib/apt/lists/lock &&
@@ -24,7 +24,7 @@ phases:
2424
exit 1
2525
}
2626
27-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
27+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
2828
displayName: 'ci/run-build-and-tests.sh'
2929
env:
3030
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -44,7 +44,7 @@ phases:
4444
name: Hosted Ubuntu 1604
4545
steps:
4646
- bash: |
47-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
47+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
4848
4949
sudo apt-get update &&
5050
sudo rm /var/lib/apt/lists/lock &&
@@ -56,7 +56,7 @@ phases:
5656
exit 1
5757
}
5858
59-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
59+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
6060
displayName: 'ci/run-build-and-tests.sh'
6161
env:
6262
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -76,7 +76,7 @@ phases:
7676
name: Hosted macOS
7777
steps:
7878
- bash: |
79-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
79+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
8080
8181
export CC=clang
8282
@@ -86,7 +86,7 @@ phases:
8686
exit 1
8787
}
8888
89-
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
89+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
9090
displayName: 'ci/run-build-and-tests.sh'
9191
env:
9292
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -106,15 +106,15 @@ phases:
106106
name: Hosted macOS
107107
steps:
108108
- bash: |
109-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
109+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
110110
111111
ci/install-dependencies.sh
112112
ci/run-build-and-tests.sh || {
113113
ci/print-test-failures.sh
114114
exit 1
115115
}
116116
117-
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
117+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
118118
displayName: 'ci/run-build-and-tests.sh'
119119
env:
120120
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -134,7 +134,7 @@ phases:
134134
name: Hosted Ubuntu 1604
135135
steps:
136136
- bash: |
137-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
137+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
138138
139139
sudo apt-get update &&
140140
sudo rm /var/lib/apt/lists/lock &&
@@ -147,7 +147,7 @@ phases:
147147
exit 1
148148
}
149149
150-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
150+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
151151
displayName: 'ci/run-build-and-tests.sh'
152152
env:
153153
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -171,7 +171,7 @@ phases:
171171
# Helper to check the error level of the latest command (exit with error when appropriate)
172172
function c() { if (!$?) { exit(1) } }
173173
174-
if ("$GITFILESHAREPWD" -ne "") {
174+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
175175
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no; c
176176
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\; c
177177
}
@@ -223,7 +223,7 @@ phases:
223223
"@
224224
c
225225
226-
if ("$GITFILESHAREPWD" -ne "") {
226+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
227227
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
228228
}
229229
displayName: 'build & test'
@@ -245,7 +245,7 @@ phases:
245245
name: Hosted Ubuntu 1604
246246
steps:
247247
- bash: |
248-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
248+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
249249
250250
sudo apt-get update &&
251251
sudo rm /var/lib/apt/lists/lock &&
@@ -266,7 +266,7 @@ phases:
266266
267267
sudo chmod a+r t/out/TEST-*.xml
268268
269-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
269+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
270270
displayName: 'ci/run-linux32-docker.sh'
271271
env:
272272
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -286,7 +286,7 @@ phases:
286286
name: Hosted Ubuntu 1604
287287
steps:
288288
- bash: |
289-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
289+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
290290
291291
sudo apt-get update &&
292292
sudo rm /var/lib/apt/lists/lock &&
@@ -296,7 +296,7 @@ phases:
296296
297297
ci/run-static-analysis.sh || exit 1
298298
299-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
299+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
300300
displayName: 'ci/run-static-analysis.sh'
301301
env:
302302
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -308,7 +308,7 @@ phases:
308308
name: Hosted Ubuntu 1604
309309
steps:
310310
- bash: |
311-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
311+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
312312
313313
sudo apt-get update &&
314314
sudo rm /var/lib/apt/lists/lock &&
@@ -319,7 +319,7 @@ phases:
319319
320320
ci/test-documentation.sh || exit 1
321321
322-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
322+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
323323
displayName: 'ci/test-documentation.sh'
324324
env:
325325
GITFILESHAREPWD: $(gitfileshare.pwd)

0 commit comments

Comments
 (0)