[worker] warn on unknown build environment#3952
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3952 +/- ##
==========================================
+ Coverage 59.18% 59.27% +0.10%
==========================================
Files 935 936 +1
Lines 41075 41159 +84
Branches 8648 8675 +27
==========================================
+ Hits 24306 24393 +87
+ Misses 16674 16666 -8
- Partials 95 100 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6e5f479 to
284fedd
Compare
284fedd to
595d6ba
Compare
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
| { job: omit(ctx.job, 'secrets', 'projectArchive') }, | ||
| 'Builder is ready, starting build' | ||
| ); | ||
| warnOnUnknownEnvironment(ctx); |
There was a problem hiding this comment.
started with a new build phase but thought it was overkill and moved here. Let me know if you have any different thoughts
595d6ba to
7af22e7
Compare
7af22e7 to
bf57252
Compare
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
|
|
||
| export function warnOnUnknownEnvironment(ctx: EnvironmentWarningContext): void { | ||
| const environment = ctx.metadata?.environment; | ||
| if (environment && !KNOWN_BUILD_ENVIRONMENTS.includes(environment)) { |
There was a problem hiding this comment.
We support custom environments, so specifying a not-known environment is not an issue per se as long as the user has environment variables in that environment?
Initially I thought we might color the environment pill yellow on workflow run page if the environment has no variables, but that would color it yellow if a user does not use EAS Environment Variables at all which is bad?
Maybe we do this ^ but only if environment is not one of the known environments? Or sth like that

Why
A workflow job with an environment that doesn't exist (e.g.
staging, vsdevelopment/preview/production) gets no warning. It silently resolves to zero environment variables and fails later in a confusing, unrelated-looking way (e.g. the app config failing to read).How
Warn in the "Spin up build environment" phase when the job's environment isn't
development/preview/production.Test Plan
Ran this job against a local worker: