Skip to content
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

fix(mac): add retry in mac code sign #8101

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

beyondkmp
Copy link
Collaborator

fix #8089

Copy link

changeset-bot bot commented Mar 6, 2024

🦋 Changeset detected

Latest commit: 09becc6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Mar 6, 2024

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit 09becc6
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/65e9fb5a2f5b02000861f99e
😎 Deploy Preview https://deploy-preview-8101--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@beyondkmp beyondkmp changed the title Feat: add retry and timeout in mac code sign. fix(mac): add retry and timeout in mac code sign. Mar 6, 2024
if (keychain != null) {
args.push("--keychain", keychain)
export async function sign(opts: SignOptions): Promise<void> {
const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it safe to add a timeout? I'm worried it won't account for slow network connections and I haven't seen any issues reported of the codesign process hanging.

Kind of in favor of just using builder-util's retry mechanism

export async function retry<T>(task: () => Promise<T>, retriesLeft: number, interval: number, backoff = 0, attempt = 0): Promise<T> {
try {
return await task()
} catch (error: any) {
log.info(`Above command failed, retrying ${retriesLeft} more times`)
if (retriesLeft > 0) {
await new Promise(resolve => setTimeout(resolve, interval + backoff * attempt))
return await retry(task, retriesLeft - 1, interval, backoff, attempt + 1)
} else {
throw error
}
}
}

Would simplify this logic to:

retry(() => signAsync(opts), 3, 5000, 5000)

3 retries, 5sec interval, with 5sec multiplier backoff delay

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agree with you

Choose a reason for hiding this comment

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

@mmaietta We've been experiencing difficulties with the codesigning process lately. We have encountered instances where the codesign process hangs, causing delays in our development workflow. This has been a recurring problem for us and has impacted our productivity. We would appreciate any assistance or guidance you can provide to resolve these codesigning issues effectively.

@beyondkmp beyondkmp changed the title fix(mac): add retry and timeout in mac code sign. fix(mac): add retry in mac code sign Mar 7, 2024
@mmaietta mmaietta merged commit 9bcede8 into electron-userland:master Mar 7, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants