[eas-build-job] Allow undefined env values#3900
Conversation
3e474f6 to
b14056d
Compare
b14056d to
36eb14c
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3900 +/- ##
==========================================
+ Coverage 59.03% 59.04% +0.01%
==========================================
Files 935 935
Lines 40931 40974 +43
Branches 8622 8632 +10
==========================================
+ Hits 24158 24187 +29
- Misses 16677 16691 +14
Partials 96 96 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the shared Env type (from @expo/eas-build-job) to allow undefined values, aligning it with Node’s process.env semantics, and adjusts downstream code to explicitly require string values at strict boundaries (e.g., GraphQL IDs / API URLs) while filtering undefined where only strings are valid.
Changes:
- Widen
EnvtoRecord<string, string | undefined>and propagate the type througheas-cli,build-tools, and worker code. - Add explicit “must be set” checks (via
nullthrows) at strict boundaries like GraphQL ID variables and certain API URL usage. - Filter
undefinedvalues out of string-only env display maps, while allowingundefinedin diagnostic metadata/extras.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/worker/src/displayRuntimeInfo.ts | Filters undefined env values from displayed “public/instance” maps; allows undefined for secret FILE paths to surface missing values in logs. |
| packages/eas-cli/src/submit/context.ts | Switches submission context env typing to shared Env. |
| packages/eas-cli/src/project/ios/target.ts | Switches iOS target resolution env typing to shared Env. |
| packages/eas-cli/src/project/ios/entitlements.ts | Switches entitlements resolution env typing to shared Env and passes it through to config resolution paths. |
| packages/eas-cli/src/fingerprint/utils.ts | Switches fingerprint helper env typing to shared Env. |
| packages/eas-cli/src/build/local.ts | Switches local build env typing to shared Env. |
| packages/eas-cli/src/build/createContext.ts | Switches build context creation env typing to shared Env. |
| packages/eas-cli/src/build/context.ts | Switches build context interface env typing to shared Env. |
| packages/eas-build-job/src/context.ts | Makes expoApiServerURL optional in the static interpolation context. |
| packages/eas-build-job/src/common.ts | Widens exported Env type to allow undefined values. |
| packages/build-tools/src/utils/expoUpdates.ts | Ensures GraphQL query variables use a defined build ID (nullthrows). |
| packages/build-tools/src/steps/functions/saveCache.ts | Requires expoApiServerURL to be present before cache upload calls. |
| packages/build-tools/src/steps/functions/restoreCache.ts | Requires expoApiServerURL to be present before cache download calls. |
| packages/build-tools/src/steps/functions/downloadArtifact.ts | Requires expoApiServerURL to be present before artifact download calls. |
| packages/build-tools/src/ios/fastlane.ts | Switches fastlane runner env typing to shared Env. |
| packages/build-tools/src/context.ts | Allows undefined values in reportError extras metadata. |
| packages/build-tools/src/common/projectSources.ts | Ensures GraphQL mutation uses a defined build ID (nullthrows). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b5c5e54 to
45c3357
Compare
45c3357 to
1fcaa05
Compare
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
|
|
||
| export type Env = Record<string, string>; | ||
| export type Env = Record<string, string | undefined>; | ||
| export const EnvSchema = Joi.object().pattern(Joi.string(), Joi.string()); |
| } | ||
| `), | ||
| { id: ctx.env.EAS_BUILD_ID } | ||
| { id: nullthrows(ctx.env.EAS_BUILD_ID, 'EAS_BUILD_ID is not set') } |
There was a problem hiding this comment.
Is it safe to do nullthrows here? What about local builds?
Summary
Widens the shared build
Envtype to allowundefinedvalues, matching Node/process env semantics where undefined entries can represent absent values.Details
EnvtoRecord<string, string | undefined>in@expo/eas-build-job.ctx.reportErrorextras to contain undefined values for diagnostic metadata.displayRuntimeInfostring-only display maps.Validation
CI should pass.