Skip to content
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] Combine .env and EAS environment variables for deploy command #2783

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

kitten
Copy link
Member

@kitten kitten commented Dec 20, 2024

Why

This allows --environment to be combined with local .env files, outputting a warning when any variables conflict since EAS environment variables will take precedence.

How

  • Update createManifestAsync to return manifest and conflicting variable names
  • Always call getEnv and merge variables into the env object
  • Output names when conflicts occurred

Test Plan

  • Tested locally

Copy link

Subscribed to pull request

File Patterns Mentions
**/* @szdziedzic, @khamilowicz, @sjchmiela, @radoslawkrzemien

Generated by CodeMention

@kitten kitten force-pushed the @kitten/feat/deploy-env-and-eas-env-simultaneously branch from c6eb6e7 to 04a5671 Compare December 20, 2024 14:22
Copy link

github-actions bot commented Dec 20, 2024

Size Change: -249 B (0%)

Total Size: 53.4 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.4 MB -249 B (0%)

compressed-size-action

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 7.14286% with 13 lines in your changes missing coverage. Please review.

Project coverage is 52.50%. Comparing base (ed2352f) to head (3510b23).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/worker/assets.ts 9.10% 10 Missing ⚠️
packages/eas-cli/src/commands/worker/deploy.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2783      +/-   ##
==========================================
- Coverage   52.52%   52.50%   -0.01%     
==========================================
  Files         583      583              
  Lines       22589    22595       +6     
  Branches     4452     4454       +2     
==========================================
  Hits        11862    11862              
- Misses      10692    10698       +6     
  Partials       35       35              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kitten kitten force-pushed the @kitten/feat/deploy-env-and-eas-env-simultaneously branch from 18ea25b to 0be4a4f Compare December 20, 2024 19:13
Copy link
Member

@wschurman wschurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for discussion: should this be the behavior for all commands that accept an --environment flag? (update, etc)

packages/eas-cli/src/worker/assets.ts Outdated Show resolved Hide resolved
packages/eas-cli/src/worker/assets.ts Show resolved Hide resolved
packages/eas-cli/src/worker/assets.ts Outdated Show resolved Hide resolved
@szdziedzic
Copy link
Member

@kitten Oh okay I think this merging can actually work. You just need to always use EXPO_NO_DOTENV=1 when making calls to Expo CLI and make EAS CLI entirely responsible for lading env vars 👍

One more thing that remains is that this logic would be different from how eas update operates. eas update does:

  1. use .env env vars when the --environment flag is not specified
  2. use EAS env vars when the --environment flag is specified and skip using .env env vars in Expo CLI by using EXPO_NO_DOTENV=1

I'm not saying this is necessarily bad I just want to make you aware of it. Why do I think this can possibly be confusing? We have 2 commands that work really similarly (deploy and update) and they would do this very differently. It can be yet another way of handling env vars in EAS.

@szdziedzic
Copy link
Member

should this be the behavior for all commands that accept an --environment flag?

EAS Build is tricky here because in 50% of the cases people have .gitignored dotenv files that are not available later on EAS servers, so I'm not sure if we really want to start supporting .env files in eas build command.

Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discussed things https://exponent-internal.slack.com/archives/C9PRD479V/p1736172771062909 with @byCedric and it seems reasonable to me 🚀 thanks 🙏

@kitten
Copy link
Member Author

kitten commented Jan 8, 2025

@szdziedzic @byCedric: Switched over to the new @expo/[email protected] API

@kitten kitten force-pushed the @kitten/feat/deploy-env-and-eas-env-simultaneously branch from c421ad2 to ccdabb2 Compare January 8, 2025 16:44
Copy link

github-actions bot commented Jan 8, 2025

✅ Thank you for adding the changelog entry!

@kitten kitten merged commit 23ebb77 into main Jan 8, 2025
7 checks passed
@kitten kitten deleted the @kitten/feat/deploy-env-and-eas-env-simultaneously branch January 8, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants