-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[eas-cli] [ENG-9957] Don't overwrite distribution for simulator builds #2073
[eas-cli] [ENG-9957] Don't overwrite distribution for simulator builds #2073
Conversation
Updated eas-build-job to new version See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Stops overwriting distribution type for simulator builds, and sets simulator field in metadata instead See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
ENG-9957 Fix internal distribution pages for simulator builds
While looking into ENG-6853I noticed that I wasn't able to access build pages for internal distribution builds that target simulators. We should support people using internal distribution for this case as well, it would allow you to share a URL to your build page where someone could then just press a button to launch in Orbit, or download and do whatever they want with it. This would work fine on Android because APKs are directly installable for devices and emulators. For example, I created a build with this profile named "simulator": https://github.com/brentvatne/microfoam-app/blob/e29d622809172be8d271622f0a699f306bffb05e/apps/mobile/eas.json#L50-L60 That build should be accessible from an incognito tab without signing in to expo.dev, as is the case with all internal distribution builds, but it is not: https://expo.dev/accounts/brents/projects/microfoam/builds/87343bae-3105-4517-a46b-d3149dea442c |
Size Change: +457 B (0%) Total Size: 51.5 MB
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2073 +/- ##
==========================================
- Coverage 54.16% 54.16% -0.00%
==========================================
Files 516 516
Lines 18808 18814 +6
Branches 3968 3969 +1
==========================================
+ Hits 10186 10188 +2
- Misses 7931 7934 +3
- Partials 691 692 +1 ☔ View full report in Codecov by Sentry. |
('simulator' in ctx.buildProfile && ctx.buildProfile.simulator | ||
? 'simulator' | ||
: ctx.buildProfile.distribution) ?? 'store'; | ||
const distribution = ctx.buildProfile.distribution ?? 'store'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will break stuff like eas build:run
🤔
I'm wondering if altering the distributionType
behavior is necessary 🤔.
Maybe we can add some new field to Metadata to keep the raw buildProfile.distribution
value there? I mean it's probably not optimal but I feel that this change can introduce some regressions in some parts of the codebase.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on why eas build:run
would be broken by this?
As for another field for "original distribution" or whatever we want to call it, I'm open for discussion but it feels to me like hacking around an existing hack (overwriting the distribution). I feel like we should remove the reliance on this hardcoded simulator
value for distribution
instead of building upon it, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it runs a simulator build and fetches it by filtering by distribution = simulator.
Maybe it should handle both options (distribution = simulator or simulator = true) for a while instead of introducing another field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur, we should list builds with both simulator: true
and distribution: simulator
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's handled in https://github.com/expo/universe/pull/13524
…-9957-dont-overwrite-distribution-for-simulator-builds # Conflicts: # packages/eas-cli/package.json # packages/eas-cli/src/build/metadata.ts # yarn.lock
Merged changes from main branch See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Updated build:run command to use simulator flag instead of overwritten distribution type See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
…-9957-dont-overwrite-distribution-for-simulator-builds # Conflicts: # packages/eas-cli/src/build/metadata.ts # packages/eas-cli/src/commands/build/run.ts # packages/eas-json/package.json # yarn.lock
…-9957-dont-overwrite-distribution-for-simulator-builds # Conflicts: # packages/eas-cli/src/graphql/generated.ts
Update graphql schema with simulator fields See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Add simulator flag to build:list command See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Fixed check function with correct field name See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Fixed failing tests after BuildFragment structure changed See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Added warning to build:list command that the distribution=simulator is deprecated See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, but I'm with @szdziedzic, I think we should not "break" listing simulator builds for now.
…-9957-dont-overwrite-distribution-for-simulator-builds
packages/eas-cli/src/run/utils.ts
Outdated
@@ -13,6 +13,7 @@ export function isRunnableOnSimulatorOrEmulator(build: BuildFragment): boolean { | |||
build.status === BuildStatus.Finished && | |||
!!build.artifacts?.applicationArchiveUrl && | |||
((build.platform === AppPlatform.Ios && build.distribution === DistributionType.Simulator) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((build.platform === AppPlatform.Ios && build.distribution === DistributionType.Simulator) || |
I guess the isForSimulator
already takes care of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, few small comments
('simulator' in ctx.buildProfile && ctx.buildProfile.simulator | ||
? 'simulator' | ||
: ctx.buildProfile.distribution) ?? 'store'; | ||
const distribution = ctx.buildProfile.distribution ?? 'store'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const distribution = ctx.buildProfile.distribution ?? 'store'; | |
const distribution = ctx.buildProfile.distribution ?? BuildDistributionType.STORE; |
Log.warn( | ||
`Using "distribution" flag with "simulator" value is deprecated - use "simulator" flag instead` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👏
Log.warn( | |
`Using "distribution" flag with "simulator" value is deprecated - use "simulator" flag instead` | |
); | |
Log.warn( | |
`Using --distribution flag with "simulator" value is deprecated - use --simulator flag instead` | |
); |
@@ -51,6 +52,7 @@ export default class BuildList extends EasCommand { | |||
...EasPaginatedQueryFlags, | |||
limit: getLimitFlagWithCustomValues({ defaultTo: 10, limit: BUILDS_LIMIT }), | |||
...EasNonInteractiveAndJsonFlags, | |||
simulator: Flags.boolean(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to add a description to this flag, putting emphasis on the fact that it will only filter the iOS simulator builds. People tend to confuse Android emulator with iOS simulator and one could think that this will also query for Android emulator builds.
@@ -51,6 +52,7 @@ export default class BuildList extends EasCommand { | |||
...EasPaginatedQueryFlags, | |||
limit: getLimitFlagWithCustomValues({ defaultTo: 10, limit: BUILDS_LIMIT }), | |||
...EasNonInteractiveAndJsonFlags, | |||
simulator: Flags.boolean(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also enforce that this is only applicable when using the ios
value for the --platform
flag? What do you think?
Added description to the new simulator flag See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Added validation so the simulator flag can only be used with --platofrm=ios See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Updated the warning displayed when using deprecated --distribution=simulator flag value See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Replaced hardcoded string with variable See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Removed no longer necessary check for simulator build See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Remember to regenerate the GQL schema if there are any changes to it in WWW PR
I would also do one test run of the eas build
command with the simulator target and see if you are prompted correctly to install it on your device afterward and run the eas build:run
command just to double check
Updated graphql schema after recent changes See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Updated graphql schema after recent changes See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
/changelog-entry chore Add simulator flag to metadata |
…-9957-dont-overwrite-distribution-for-simulator-builds # Conflicts: # CHANGELOG.md
Added screens for comparison |
…-9957-dont-overwrite-distribution-for-simulator-builds
Updated graphql schema after recent changes See: https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
✅ Thank you for adding the changelog entry! |
Why
https://linear.app/expo/issue/ENG-9957/fix-internal-distribution-pages-for-simulator-builds
Companion for: expo/eas-build#283, https://github.com/expo/universe/pull/13524, and https://github.com/expo/universe/pull/13523
How
simulator
if simulator flag is set, keeping its original valueTest Plan
Existing tests pass
Screens
Build run with old cli version
Logged in
Internal build
Internal simulator build
Store build
Store simulator build
Not logged in
Internal build
Internal simulator build
Store build
Store simulator build
Build run with new cli version
Logged in
Internal build
Internal simulator build
Store build
Store simulator build
Not logged in
Internal build
Internal simulator build
Store build
Store simulator build
Deployment