[build-tools] Early stop eas/start_android_emulator when Android emulator host setup is invalid#3580
[build-tools] Early stop eas/start_android_emulator when Android emulator host setup is invalid#3580
eas/start_android_emulator when Android emulator host setup is invalid#3580Conversation
… emulator when not on nested virtualization enabled host
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3580 +/- ##
==========================================
+ Coverage 54.26% 54.44% +0.18%
==========================================
Files 821 821
Lines 35327 35348 +21
Branches 7363 7369 +6
==========================================
+ Hits 19166 19240 +74
+ Misses 16074 16017 -57
- Partials 87 91 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Align Android emulator nested-virtualization detection with step runtime metadata instead of Node process platform, and expand tests to assert early failure on non-Linux runtime platforms.
Return a typed user-facing error when Android emulator virtualization requirements are not met so this early-stop path avoids noisy unknown-error stack output.
|
Subscribed to pull request
Generated by CodeMention |
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
eas/start_android_emulator when emulator hardware acceleration is not available
Keep the startAndroidEmulator test helper aligned with main by removing the temporary runtime platform override from createStep.
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
| }); | ||
| } | ||
|
|
||
| async function assertNestedVirtualizationIsAvailableAsync({ |
There was a problem hiding this comment.
question: now that I'm thinking about it maybe this check should not force-fail the job, but instead only print a helpful warning? We can then add an annotation on the log to make it even more prominent. https://expo.dev/admin/annotations
What happens if a user does start_android_emulator on non-virtualized VM? Does emulator return a non-zero code or do we just "fail, waiting"?
EDIT: Ok looking more, judging by https://staging.expo.dev/accounts/gwdp/projects/coin-flip/workflows/019d73d1-261b-793a-9db7-98cfa335c197 we don't even install emulator on non-nested VMs which means emulator should fail which means start_android_emulator step fails with ENOENT or sth like that which is not too helpful. so maybe your solution is good, but maybe let's rename stuff to indicate that we're checking emulator is set up correctly or what
There was a problem hiding this comment.
Took this path of the early failure since my reproduction did show 9m+ of execution into the start emulator function until failure on non nested environment and thought about potential savings with the early path. Renamed things slightly, let me now if aligned
packages/build-tools/src/steps/functions/startAndroidEmulator.ts
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| async function getIsNestedVirtualizationEnabledAsync(env: NodeJS.ProcessEnv): Promise<boolean> { |
There was a problem hiding this comment.
now that it's returning false if we don't have ANDROID_HOME set let's rename it to something different?
There was a problem hiding this comment.
Actually, reasoning further, failure pattern when/if ANDROID_HOME is missing would be quite obscure, since spawn would not produce any logs and just assertion would be raised.
If you are aligned, I modified it to use empty sdk path and actually execute with it, so failure is more visible to us if that ever happen. Thoughts?
ccc1dc3 to
69a110b
Compare
|
✅ Thank you for adding the changelog entry! |
eas/start_android_emulator when emulator hardware acceleration is not availableeas/start_android_emulator when Android emulator host setup is invalid
Why
Starting an Android emulator without nested virtualization support always fails, but today that failure happens later and with less actionable context.
Adding nested virtualization detection to start_android_emulator allows us to fail fast with a clearer error message when the VM does not support emulator hardware acceleration.
How
Add an early preflight check in start_android_emulator to detect whether emulator acceleration prerequisites are present (including VMX/SVM support).
If acceleration is not available, fail fast with a clear, user-friendly error explaining that nested virtualization is required and how to enable it.
Test Plan
-accel-checkon nested and non nested virtualization to confirm command behavior https://staging.expo.dev/accounts/gwdp/projects/coin-flip/workflows/019d73d1-261b-793a-9db7-98cfa335c197Ref ENG-17446