Skip to content

[build-tools] Resolve job environment after metadata update#3899

Draft
sjchmiela wants to merge 1 commit into
stanley/update-env-overrides-existingfrom
stanley/resolve-job-information-env
Draft

[build-tools] Resolve job environment after metadata update#3899
sjchmiela wants to merge 1 commit into
stanley/update-env-overrides-existingfrom
stanley/resolve-job-information-env

Conversation

@sjchmiela

@sjchmiela sjchmiela commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #3900. Refreshes derived EAS build environment variables after GitHub-triggered job information and metadata are resolved, instead of patching Android Gradle execution directly.

I want to unify runGradleCommand and I noticed that only one of them polyfills the EAS_ environment variables for GitHub builds.

Details

  • Adds a shared getResolvedJobInformationEnv helper in @expo/build-tools for profile, commit hash, username, and platform version env vars.
  • Calls that helper from both BuildContext.updateJobInformation and CustomBuildContext.updateJobInformation so traditional and custom/steps builds see the resolved env.
  • Reuses the helper from the worker initial build env construction to keep the mapping consistent.
  • Removes the Gradle-only Android version env fallback.

Validation

CI should pass.

@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch 4 times, most recently from d3ac20b to 8730d58 Compare June 25, 2026 13:03
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.03%. Comparing base (5c24631) to head (6b8a4dd).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           stanley/update-env-overrides-existing    #3899      +/-   ##
=========================================================================
+ Coverage                                  59.02%   59.03%   +0.02%     
=========================================================================
  Files                                        935      935              
  Lines                                      40946    40947       +1     
  Branches                                    8624     8620       -4     
=========================================================================
+ Hits                                       24165    24171       +6     
+ Misses                                     16686    16681       -5     
  Partials                                      95       95              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch 2 times, most recently from c70c1b4 to 6368925 Compare June 25, 2026 13:18
@sjchmiela sjchmiela changed the base branch from main to stanley/env-allows-undefined June 25, 2026 13:19
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from a4d5fc9 to 3e474f6 Compare June 25, 2026 13:23
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from 6368925 to 4350086 Compare June 25, 2026 13:23
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from 3e474f6 to b14056d Compare June 25, 2026 13:29
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from 4350086 to 8dbf578 Compare June 25, 2026 13:30
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from b14056d to 36eb14c Compare June 25, 2026 13:37
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from 8dbf578 to d1291fa Compare June 25, 2026 13:37
@sjchmiela sjchmiela added the no changelog PR that doesn't require a changelog entry label Jun 25, 2026
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from 159bcd5 to 722f6cf Compare June 25, 2026 13:49
@sjchmiela sjchmiela requested a review from Copilot June 25, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR centralizes the mapping of “resolved job information” into EAS_BUILD_* environment variables and ensures both traditional and custom/steps builds receive the same resolved values after GitHub-triggered job metadata is updated, removing the Android Gradle-specific fallback.

Changes:

  • Introduces getResolvedJobInformationEnv(job, metadata) in @expo/build-tools and reuses it across worker env construction and build context job updates.
  • Updates both BuildContext.updateJobInformation and CustomBuildContext.updateJobInformation to apply the resolved env mapping.
  • Removes the Gradle-only Android version env override logic and adds/updates tests to cover the new behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/worker/src/env.ts Uses the shared resolver to populate EAS_BUILD_* envs during initial worker env construction.
packages/build-tools/src/index.ts Re-exports getResolvedJobInformationEnv from the package entrypoint.
packages/build-tools/src/customBuildContext.ts Updates custom build env after job/metadata resolution using the shared resolver.
packages/build-tools/src/context.ts Adds the shared resolver and applies it after updateJobInformation.
packages/build-tools/src/android/gradle.ts Removes Gradle-only Android version env fallback now that envs are refreshed centrally.
packages/build-tools/src/tests/customBuildContext.test.ts Adds coverage to ensure custom context env is updated after resolved job information is applied.
packages/build-tools/src/tests/context.test.ts Adds coverage to ensure BuildContext env is updated after resolved job information is applied.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 313 to +314
this._metadata = metadata;
this.updateEnv(getResolvedJobInformationEnv(this._job, this._metadata));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixing in #3901

@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch 2 times, most recently from 5e42c1c to dff7d83 Compare June 25, 2026 14:12
@sjchmiela sjchmiela changed the base branch from stanley/env-allows-undefined to stanley/update-env-overrides-existing June 25, 2026 14:12
@sjchmiela sjchmiela requested a review from Copilot June 25, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@sjchmiela sjchmiela force-pushed the stanley/update-env-overrides-existing branch from e83065d to e808064 Compare June 26, 2026 10:49
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from dff7d83 to d28e79e Compare June 26, 2026 10:49
@sjchmiela sjchmiela force-pushed the stanley/update-env-overrides-existing branch from e808064 to 43511f2 Compare June 26, 2026 10:53
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from d28e79e to 757120e Compare June 26, 2026 10:53
@sjchmiela sjchmiela force-pushed the stanley/resolve-job-information-env branch from 757120e to 6b8a4dd Compare June 26, 2026 11:16
@github-actions

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants