Commit d3e0fc8
authored
[CI] Avoid use of
Context: https://github.com/MicrosoftDocs/azure-devops-docs/issues/3265
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3679916&view=logs&j=8556562a-ae5f-5bd1-7c4d-bf1af4b6f1e1&t=5076e147-fc66-561e-6c69-3aa777afefc5
We sometimes observe experiencing "weird issue" on AzDO CI in which
the **Test** > **APK Instrumentation** step fails:
…/external/Java.Interop/src/Java.Interop/Java.Interop.targets(37,5): error MSB3073: The command """ -source 1.6 -target 1.6 -bootclasspath "" -d "obj/Release/ji-classes" java/com/xamarin/java_interop/internal/JavaProxyObject.java java/com/xamarin/java_interop/internal/JavaProxyThrowable.java java/com/xamarin/java_interop/GCUserPeerable.java java/com/xamarin/java_interop/ManagedPeer.java" exited with code 127.
The cause of the issue is that `make -C external/Java.Interop prepare`
is never executed, which is *bizarre*, because `xaprepare -s=Required`
is responsible for calling it; see 130905e.
Checking the build logs, and we see that the
**install test dependencies** job *appears* to run it:
##[debug]script=mono build-tools/xaprepare/xaprepare/bin/Release/xaprepare.exe --s=UpdateMono --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI
mono build-tools/xaprepare/xaprepare/bin/Release/xaprepare.exe --s=Required --auto-provision=yes --auto-provision-uses-sudo=yes --no-emoji --run-mode=CI
mono build-tools/xaprepare/xaprepare/bin/Release/xaprepare.exe --s=AndroidToolchain --no-emoji --run-mode=CI
…but it doesn't actually *successfully* run *all* those commands!
Instead, only `xaprepare -s=AndroidToolchain` finishes:
% grep 'Running scenario' prepare-*
prepare-20200427T203230.log:[00:00:21.6506301] Running scenario: Install Android SDK, NDK and Corretto JDK.
Compare to:
% grep 'Initializing scenario' prepare-*
prepare-20200427T203008.log:[00:00:00.2793986] Initializing scenario UpdateMono
prepare-20200427T203116.log:[00:00:00.4118305] Initializing scenario Required
prepare-20200427T203230.log:[00:00:00.2998047] Initializing scenario AndroidToolchain
It appears that at present Azure DevOps `script` blocks don't run via
[`bash -e`][0] -- which would cause a failure if any command exits
with a failre -- which means that the errors emitted from
`xaprepare -s=UpdateMono` and `xaprepare -s=Required` are *ignored*.
***We do not want to ignore errors.***
As such, @jonpryor now regards *all* `script: |` YAML as potentially
wrong or buggy.
Replace all `script: |` blocks with `script: >` blocks. `script: >`
blocks replace newlines with a space, turning the block into a
*single command*. This in turn requires inserting `&&` between
intermediate commands, so that subsequent commands only execute if the
previous commands exited successfully.
Thus, turn this:
- script: |
command1
command2
into:
- script: >
command1 &&
command2
The DevOps `script` handler doesn't ignore *all* errors,
and the above transformation means that the `script` block itself will
exit with a failure if any command within the pipeline fails.
[0]: https://stackoverflow.com/a/9952249scipt: | blocks (#4634)1 parent bea063b commit d3e0fc8
File tree
4 files changed
+31
-31
lines changed- build-tools/automation
- yaml-templates
4 files changed
+31
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
| 144 | + | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
| 176 | + | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
0 commit comments