Skip to content

[eas-cli] Add --refresh-distribution-certificate for non-intractive builds#3739

Open
sswrk wants to merge 2 commits into
graphite-base/3739from
szymonswierk/eng-21330-make-it-possible-to-refresh-a-distribution-certificate-in
Open

[eas-cli] Add --refresh-distribution-certificate for non-intractive builds#3739
sswrk wants to merge 2 commits into
graphite-base/3739from
szymonswierk/eng-21330-make-it-possible-to-refresh-a-distribution-certificate-in

Conversation

@sswrk
Copy link
Copy Markdown
Contributor

@sswrk sswrk commented May 18, 2026

Why

When there's no valid distribution certificate associated with an app, and a non-interactive development build is run (e.g. invoked by CI or by a workflow job), even without the freeze-credentials flag, the distribution certificate is not validated or refreshed, which may fail the internal build and require doing manual eas build to create a new certificate. See the Linear issue: https://linear.app/expo/issue/ENG-21330/make-it-possible-to-refresh-a-distribution-certificate-in-non

How

Added an opt-in distribution certificate refresh to non-interactive builds with flag --refresh-distribution-certificate.

When the flag is present, we hit www GQL API to get the ASC API key (the submission key), and we distribution certificate validation or set-up if needed. packages/eas-cli/src/credentials/ios/actions/SetUpDistributionCertificate.ts is where this logic happens.

The flag mustn't be present when --freeze-credentials is present, these are conflicting flags.

I'm leaning towards an opt-in flag instead of extending the default behavior because of the extra credentials configuration requirements and side effects of the distribution certificate refresh logic.

Test Plan

Added unit tests.

Manual verification:

  • Did easd build --platform ios --profile development --non-interactive --refresh-distribution-certificate in the following scenarios, verified it works:
    • current certificate is valid
    • current certificate is invalid
  • Did easd build --platform ios --profile development --non-interactive --refresh-distribution-certificate --refresh-ad-hoc-provisioning-profile, verified the ASC API key got resolved just once.

@linear
Copy link
Copy Markdown

linear Bot commented May 18, 2026

ENG-21330

Copy link
Copy Markdown
Contributor Author

sswrk commented May 18, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sswrk sswrk changed the title [eas-cli] Add --refresh-distribution-certificate for non-intractive builds [eas-cli] Add --refresh-distribution-certificate for non-intractive builds May 18, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 86.27451% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.00%. Comparing base (d4b4bf6) to head (6436e27).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/build/index.ts 0.00% 2 Missing and 3 partials ⚠️
packages/eas-cli/src/build/createContext.ts 0.00% 1 Missing ⚠️
...tials/ios/actions/SetUpAdhocProvisioningProfile.ts 66.67% 1 Missing ⚠️
Additional details and impacted files
@@                                                  Coverage Diff                                                  @@
##           szymonswierk/eng-7041-allow-including-all-eas-registered-devices-automatically-in    #3739      +/-   ##
=====================================================================================================================
+ Coverage                                                                              56.88%   57.00%   +0.12%     
=====================================================================================================================
  Files                                                                                    904      904              
  Lines                                                                                  39177    39217      +40     
  Branches                                                                                8202     8215      +13     
=====================================================================================================================
+ Hits                                                                                   22283    22352      +69     
+ Misses                                                                                 15422    15395      -27     
+ Partials                                                                                1472     1470       -2     

☔ View full report in Codecov by Sentry.
📢 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.

@sswrk sswrk marked this pull request as ready for review May 18, 2026 13:24
@github-actions
Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder
packages/eas-cli/src/commands/build/** @sjchmiela
packages/eas-cli/src/build/** @sjchmiela

Generated by CodeMention

@sswrk sswrk requested review from quinlanj and sjchmiela May 18, 2026 13:27
@sswrk sswrk force-pushed the szymonswierk/eng-21330-make-it-possible-to-refresh-a-distribution-certificate-in branch from 763d237 to 1e21106 Compare May 20, 2026 11:43
@sswrk sswrk force-pushed the szymonswierk/eng-7041-allow-including-all-eas-registered-devices-automatically-in branch 2 times, most recently from 701b7d7 to 4c939d9 Compare May 20, 2026 11:57
@sswrk sswrk force-pushed the szymonswierk/eng-21330-make-it-possible-to-refresh-a-distribution-certificate-in branch 2 times, most recently from 354509c to e1e9a7e Compare May 20, 2026 12:01
Copy link
Copy Markdown
Member

@quinlanj quinlanj left a comment

Choose a reason for hiding this comment

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

lgtm. I'm surprised this was a feature people asked for because the number of dist certs apple lets you have in your account is very low (2-3 max)

return currentCertificate;
}

Log.warn('Current distribution certificate is invalid. Creating a new one...');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

move this log.warn to when we actually create a new cert, since it's possible we could reuse

Suggested change
Log.warn('Current distribution certificate is invalid. Creating a new one...');

Log.log(`Reusing distribution certificate with serial number ${cert.serialNumber}`);
return cert;
}
return await this.createNewDistCertAsync(ctx);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
return await this.createNewDistCertAsync(ctx);
Log.warn('Current distribution certificate is invalid. Creating a new one...');
return await this.createNewDistCertAsync(ctx);

@sswrk sswrk force-pushed the szymonswierk/eng-7041-allow-including-all-eas-registered-devices-automatically-in branch from d20291d to d4b4bf6 Compare May 21, 2026 11:37
@sswrk sswrk force-pushed the szymonswierk/eng-21330-make-it-possible-to-refresh-a-distribution-certificate-in branch from e1e9a7e to 6436e27 Compare May 21, 2026 11:37
@github-actions
Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@sswrk sswrk changed the base branch from szymonswierk/eng-7041-allow-including-all-eas-registered-devices-automatically-in to graphite-base/3739 May 21, 2026 12:04
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.

2 participants