-
Notifications
You must be signed in to change notification settings - Fork 11
🤖 Fix keychain race condition in parallel macOS signing #234
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
Conversation
Problem: When running parallel electron-builder processes (x64 + arm64), both try to create the same keychain simultaneously, causing: SecKeychainCreate: A keychain with the same name already exists Solution: Pre-create and configure keychain in setup-macos-signing.sh before running parallel builds. This ensures: - Certificate is imported before electron-builder runs - Both parallel processes use the same pre-configured keychain - No race condition on keychain creation Changes: - Create unique keychain with timestamp - Import certificate into keychain before parallel builds - Configure keychain permissions for codesign - Export CSC_KEYCHAIN for electron-builder - Add verification step to confirm signing is enabled
e8b1965 to
eba94fe
Compare
💡 Codex ReviewLines 165 to 169 in 187855e
The new ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. |
Codex identified that 'wait' without args only returns the exit code of the last job. Now we: - Capture PIDs for both background jobs - Wait on each PID individually with && to fail if either fails - Ensure both architectures succeed before printing success message This fixes both dist-mac and dist-mac-release targets.
|
@codex review |
electron-builder's internal keychain creation conflicts when run in parallel, even with pre-created keychains. Simplest fix: - Detect if CSC_LINK is set (signing enabled) - If yes: build sequentially to avoid keychain conflicts - If no: build in parallel for speed This guarantees no race conditions while preserving parallelism for unsigned builds (PR tests, local dev).
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. |
Problem
PR #227 introduced parallel builds for macOS (x64 + arm64), which caused a race condition during code signing:
Both electron-builder processes try to create the same keychain simultaneously.
Solution
Pre-create and configure the keychain in
setup-macos-signing.shbefore running parallel builds.Changes
CSC_KEYCHAINso electron-builder uses the pre-configured keychainFlow
Before (broken):
After (fixed):
Testing
This will be tested on the next release. The PR workflow doesn't test signing (no secrets), so we can't verify in CI.
Impact
Generated with
cmux