Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ci(desktop): log CloudKit connectivity during notarization (#8098)

Eric Hayes85dd5a41827a
diff --git a/.github/workflows/build_desktop_on_tag.yml b/.github/workflows/build_desktop_on_tag.yml
index 3ae3c90778..645df921f2 100644
--- a/.github/workflows/build_desktop_on_tag.yml
+++ b/.github/workflows/build_desktop_on_tag.yml
@@ -587,14 +587,55 @@ jobs:
key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")
issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")
+ probe_https() {
+ local label="$1" url="$2" family="${3:-}" status=0
+ local -a curl_args=(--silent --show-error --output /dev/null --connect-timeout 5 --max-time 10)
+ if [ -n "$family" ]; then
+ curl_args+=("$family")
+ fi
+ echo "$label HTTPS probe (an HTTP error still confirms connectivity):"
+ curl "${curl_args[@]}" \
+ --write-out 'remote_ip=%{remote_ip} http=%{http_code} dns_s=%{time_namelookup} tcp_s=%{time_connect} tls_s=%{time_appconnect} total_s=%{time_total}\n' \
+ "$url" || status=$?
+ echo "$label curl_exit=$status"
+ }
+
+ cloudkit_diagnostics() {
+ echo '::group::CloudKit connection diagnostics'
+ date -u '+time_utc=%Y-%m-%dT%H:%M:%SZ'
+ sw_vers -productVersion | sed 's/^/macos_version=/' || true
+ xcodebuild -version || true
+ curl --version | head -n 1 || true
+ echo 'System proxy flags:'
+ scutil --proxy | awk '$1 ~ /^(HTTPEnable|HTTPSEnable|ProxyAutoConfigEnable|SOCKSEnable)$/ { print $1 "=" $3 }' || true
+ echo 'CloudKit DNS addresses:'
+ dscacheutil -q host -a name api.apple-cloudkit.com | awk '/^(name|ip_address):/ { print }' || true
+ probe_https CloudKit-default 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup'
+ probe_https CloudKit-IPv4 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv4
+ probe_https CloudKit-IPv6 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv6
+ probe_https Apple-control 'https://www.apple.com/'
+ echo '::endgroup::'
+ }
+
+ run_stapler() {
+ local operation="$1" target="$2" status=0
+ xcrun stapler "$operation" -v "$target" || status=$?
+ if [ "$status" -ne 0 ]; then
+ echo "stapler $operation failed for $target with exit code $status" >&2
+ cloudkit_diagnostics
+ fi
+ return "$status"
+ }
+
# Submission failure, rejection, or timeout must prevent publishing this build.
xcrun notarytool submit "$dmg" \
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/submission.json"
cat "$credentials_dir/submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null
- xcrun stapler staple "$dmg"
- xcrun stapler validate "$dmg"
+ cloudkit_diagnostics
+ run_stapler staple "$dmg"
+ run_stapler validate "$dmg"
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"
# The updater ships the app rather than the DMG. Notarize and staple that exact
@@ -604,8 +645,9 @@ jobs:
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/app-submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/app-submission.json" > /dev/null
- xcrun stapler staple updater-app/Macro.app
- xcrun stapler validate updater-app/Macro.app
+ cloudkit_diagnostics
+ run_stapler staple updater-app/Macro.app
+ run_stapler validate updater-app/Macro.app
codesign --verify --deep --strict --verbose=2 updater-app/Macro.app
spctl --assess --type execute --verbose=2 updater-app/Macro.app
version=$(jq -er '.version' apps/web/tauri/desktop-release.json)
diff --git a/.github/workflows/build_dmg_on_tag.yml b/.github/workflows/build_dmg_on_tag.yml
index 3f6b98e896..2f7d8219c0 100644
--- a/.github/workflows/build_dmg_on_tag.yml
+++ b/.github/workflows/build_dmg_on_tag.yml
@@ -400,14 +400,55 @@ jobs:
key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")
issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")
+ probe_https() {
+ local label="$1" url="$2" family="${3:-}" status=0
+ local -a curl_args=(--silent --show-error --output /dev/null --connect-timeout 5 --max-time 10)
+ if [ -n "$family" ]; then
+ curl_args+=("$family")
+ fi
+ echo "$label HTTPS probe (an HTTP error still confirms connectivity):"
+ curl "${curl_args[@]}" \
+ --write-out 'remote_ip=%{remote_ip} http=%{http_code} dns_s=%{time_namelookup} tcp_s=%{time_connect} tls_s=%{time_appconnect} total_s=%{time_total}\n' \
+ "$url" || status=$?
+ echo "$label curl_exit=$status"
+ }
+
+ cloudkit_diagnostics() {
+ echo '::group::CloudKit connection diagnostics'
+ date -u '+time_utc=%Y-%m-%dT%H:%M:%SZ'
+ sw_vers -productVersion | sed 's/^/macos_version=/' || true
+ xcodebuild -version || true
+ curl --version | head -n 1 || true
+ echo 'System proxy flags:'
+ scutil --proxy | awk '$1 ~ /^(HTTPEnable|HTTPSEnable|ProxyAutoConfigEnable|SOCKSEnable)$/ { print $1 "=" $3 }' || true
+ echo 'CloudKit DNS addresses:'
+ dscacheutil -q host -a name api.apple-cloudkit.com | awk '/^(name|ip_address):/ { print }' || true
+ probe_https CloudKit-default 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup'
+ probe_https CloudKit-IPv4 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv4
+ probe_https CloudKit-IPv6 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv6
+ probe_https Apple-control 'https://www.apple.com/'
+ echo '::endgroup::'
+ }
+
+ run_stapler() {
+ local operation="$1" target="$2" status=0
+ xcrun stapler "$operation" -v "$target" || status=$?
+ if [ "$status" -ne 0 ]; then
+ echo "stapler $operation failed for $target with exit code $status" >&2
+ cloudkit_diagnostics
+ fi
+ return "$status"
+ }
+
# Submission failure, rejection, or timeout must prevent publishing this build.
xcrun notarytool submit "$dmg" \
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/submission.json"
cat "$credentials_dir/submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null
- xcrun stapler staple "$dmg"
- xcrun stapler validate "$dmg"
+ cloudkit_diagnostics
+ run_stapler staple "$dmg"
+ run_stapler validate "$dmg"
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"
# The updater ships the app rather than the DMG. Notarize and staple that exact
@@ -417,8 +458,9 @@ jobs:
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/app-submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/app-submission.json" > /dev/null
- xcrun stapler staple updater-app/Macro.app
- xcrun stapler validate updater-app/Macro.app
+ cloudkit_diagnostics
+ run_stapler staple updater-app/Macro.app
+ run_stapler validate updater-app/Macro.app
codesign --verify --deep --strict --verbose=2 updater-app/Macro.app
spctl --assess --type execute --verbose=2 updater-app/Macro.app
version=$(jq -er '.version' apps/web/tauri/desktop-release.json)
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh
index 072ad237da..fbac7a38e7 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/notarize_dmg.sh
@@ -22,14 +22,55 @@ jq -er '.APPLE_API_PRIVATE_KEY | strings | select(length > 0)' \
key_id=$(jq -er '.APPLE_API_KEY_ID | strings | select(length > 0)' "$credentials_dir/secrets.json")
issuer=$(jq -er '.APPLE_API_ISSUER | strings | select(length > 0)' "$credentials_dir/secrets.json")
+probe_https() {
+ local label="$1" url="$2" family="${3:-}" status=0
+ local -a curl_args=(--silent --show-error --output /dev/null --connect-timeout 5 --max-time 10)
+ if [ -n "$family" ]; then
+ curl_args+=("$family")
+ fi
+ echo "$label HTTPS probe (an HTTP error still confirms connectivity):"
+ curl "${curl_args[@]}" \
+ --write-out 'remote_ip=%{remote_ip} http=%{http_code} dns_s=%{time_namelookup} tcp_s=%{time_connect} tls_s=%{time_appconnect} total_s=%{time_total}\n' \
+ "$url" || status=$?
+ echo "$label curl_exit=$status"
+}
+
+cloudkit_diagnostics() {
+ echo '::group::CloudKit connection diagnostics'
+ date -u '+time_utc=%Y-%m-%dT%H:%M:%SZ'
+ sw_vers -productVersion | sed 's/^/macos_version=/' || true
+ xcodebuild -version || true
+ curl --version | head -n 1 || true
+ echo 'System proxy flags:'
+ scutil --proxy | awk '$1 ~ /^(HTTPEnable|HTTPSEnable|ProxyAutoConfigEnable|SOCKSEnable)$/ { print $1 "=" $3 }' || true
+ echo 'CloudKit DNS addresses:'
+ dscacheutil -q host -a name api.apple-cloudkit.com | awk '/^(name|ip_address):/ { print }' || true
+ probe_https CloudKit-default 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup'
+ probe_https CloudKit-IPv4 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv4
+ probe_https CloudKit-IPv6 'https://api.apple-cloudkit.com/database/1/com.apple.gk.ticket-delivery/production/public/records/lookup' --ipv6
+ probe_https Apple-control 'https://www.apple.com/'
+ echo '::endgroup::'
+}
+
+run_stapler() {
+ local operation="$1" target="$2" status=0
+ xcrun stapler "$operation" -v "$target" || status=$?
+ if [ "$status" -ne 0 ]; then
+ echo "stapler $operation failed for $target with exit code $status" >&2
+ cloudkit_diagnostics
+ fi
+ return "$status"
+}
+
# Submission failure, rejection, or timeout must prevent publishing this build.
xcrun notarytool submit "$dmg" \
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/submission.json"
cat "$credentials_dir/submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/submission.json" > /dev/null
-xcrun stapler staple "$dmg"
-xcrun stapler validate "$dmg"
+cloudkit_diagnostics
+run_stapler staple "$dmg"
+run_stapler validate "$dmg"
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"
# The updater ships the app rather than the DMG. Notarize and staple that exact
@@ -39,8 +80,9 @@ xcrun notarytool submit "$credentials_dir/updater-app.zip" \
--key "$credentials_dir/AuthKey.p8" --key-id "$key_id" --issuer "$issuer" \
--wait --timeout 30m --output-format json > "$credentials_dir/app-submission.json"
jq -e '.status == "Accepted"' "$credentials_dir/app-submission.json" > /dev/null
-xcrun stapler staple updater-app/Macro.app
-xcrun stapler validate updater-app/Macro.app
+cloudkit_diagnostics
+run_stapler staple updater-app/Macro.app
+run_stapler validate updater-app/Macro.app
codesign --verify --deep --strict --verbose=2 updater-app/Macro.app
spctl --assess --type execute --verbose=2 updater-app/Macro.app
version=$(jq -er '.version' apps/web/tauri/desktop-release.json)