mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Improve Mac notarization stapling reliability (#5479)
- Verify code signature before attempting to staple (catches transfer corruption) - Increase retry attempts from 5 to 10 - Increase wait between retries from 10s to 30s (total wait up to 5 minutes) - Capture and display stapler error output for better debugging - Show signature details if verification fails This addresses intermittent stapling failures due to Apple CloudKit propagation delays after notarization completes. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,22 +50,34 @@ if [ "$STATUS" != "Accepted" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Verifying code signature before stapling ==="
|
||||
if ! codesign --verify --deep --strict "$APP_PATH" 2>&1; then
|
||||
echo "ERROR: Code signature verification failed - app may have been damaged during transfer"
|
||||
echo "Attempting to show signature details:"
|
||||
codesign -dvvv "$APP_PATH" 2>&1 || true
|
||||
exit 1
|
||||
fi
|
||||
echo "Code signature verified successfully"
|
||||
|
||||
echo "=== Stapling notarization ticket to app ==="
|
||||
# Retry stapling - Apple's CloudKit can have a brief delay after notarization completes
|
||||
MAX_STAPLE_ATTEMPTS=5
|
||||
# Retry stapling - Apple's CloudKit can take several minutes to propagate the ticket
|
||||
MAX_STAPLE_ATTEMPTS=10
|
||||
STAPLE_WAIT_SECONDS=30
|
||||
STAPLE_ATTEMPT=1
|
||||
while [ $STAPLE_ATTEMPT -le $MAX_STAPLE_ATTEMPTS ]; do
|
||||
echo "Stapling attempt $STAPLE_ATTEMPT/$MAX_STAPLE_ATTEMPTS..."
|
||||
if xcrun stapler staple "$APP_PATH"; then
|
||||
if STAPLE_OUTPUT=$(xcrun stapler staple "$APP_PATH" 2>&1); then
|
||||
echo "$STAPLE_OUTPUT"
|
||||
echo "Stapling successful"
|
||||
break
|
||||
fi
|
||||
echo "Stapler output: $STAPLE_OUTPUT"
|
||||
if [ $STAPLE_ATTEMPT -eq $MAX_STAPLE_ATTEMPTS ]; then
|
||||
echo "ERROR: Stapling failed after $MAX_STAPLE_ATTEMPTS attempts"
|
||||
echo "ERROR: Stapling failed after $MAX_STAPLE_ATTEMPTS attempts (total wait: $((MAX_STAPLE_ATTEMPTS * STAPLE_WAIT_SECONDS)) seconds)"
|
||||
exit 1
|
||||
fi
|
||||
echo "Stapling failed, waiting 10 seconds before retry..."
|
||||
sleep 10
|
||||
echo "Stapling failed, waiting $STAPLE_WAIT_SECONDS seconds before retry..."
|
||||
sleep $STAPLE_WAIT_SECONDS
|
||||
STAPLE_ATTEMPT=$((STAPLE_ATTEMPT + 1))
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user