[CI] Retry simulator runtime downloads on transient network failures. Fixes #26288 - #26406
Conversation
Simulator runtime downloads via 'xcodebuild -downloadPlatform' in system-dependencies.sh occasionally fail with transient network errors during 'Provision system dependencies', before any tests run. When the requested runtime isn't available through the normal mechanism, xcodebuild falls back to downloading it from Apple's downloadable simulator index, and that transport sometimes stalls until curl fails (e.g. 'curl: (56) Recv failure: Operation timed out'). In that fallback case xcodebuild frequently still exits 0 while only printing the failure to stdout, so its exit code can't be trusted. Add an 'xcodebuild_download_platform' helper that retries the download up to 5 times (with a 15s delay between attempts). Rather than trusting xcodebuild's exit code or parsing its output, it determines whether a download attempt succeeded by checking the desired result directly: is the simulator runtime actually installed and available afterwards (via 'xcrun simctl list runtimes')? This is the same kind of check already used in check_old_simulators. Use the helper for all three '-downloadPlatform' call sites. Fixes #26288 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21cd82f0-9796-4e4a-9c75-52afc69218bf
There was a problem hiding this comment.
Pull request overview
This PR hardens CI provisioning by adding a retrying wrapper around xcodebuild -downloadPlatform, and validating success by checking the simulator runtime is actually installed via simctl, rather than trusting xcodebuild’s exit code/output.
Changes:
- Added
is_simulator_runtime_installedto verify a given simulator runtime is present/available usingxcrun simctl list runtimes+jq. - Added
xcodebuild_download_platformhelper to retry platform downloads up to 5 times, sleeping 15s between attempts, and verifying installation after each attempt. - Switched existing
-downloadPlatformcall sites to use the retry helper.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…lled The generic 'xcodebuild -downloadPlatform iOS/tvOS' call sites passed an empty version to xcodebuild_download_platform, so the post-download check succeeded as soon as *any* iOS/tvOS runtime was installed. A transient download failure would then go undetected and the retry loop would be ineffective (as pointed out in PR review). Pass the expected runtime version (IOS_NUGET_OS_VERSION / TVOS_NUGET_OS_VERSION from Make.versions) so the check validates the runtime we actually need. Since simctl reports a patch version for the most recent runtimes (e.g. '26.5.1' when we expect '26.5'), the version check now also accepts a patch release of the expected version. The expected version is used only to verify the install; the arguments passed to xcodebuild are now given explicitly by each call site. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21cd82f0-9796-4e4a-9c75-52afc69218bf
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [CI Build #1ae6acd] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 203 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Simulator runtime downloads via
xcodebuild -downloadPlatforminsystem-dependencies.shoccasionally fail with transient network errors during "Provision system dependencies", before any tests run. When the requested runtime isn't available through the normal mechanism,xcodebuildfalls back to downloading it from Apple's downloadable simulator index, and that transport sometimes stalls until curl fails (e.g.curl: (56) Recv failure: Operation timed out). In that fallback casexcodebuildfrequently still exits 0 while only printing the failure to stdout, so its exit code can't be trusted.This adds an
xcodebuild_download_platformhelper that retries the download up to 5 times (with a 15s delay between attempts). Rather than trustingxcodebuild's exit code or parsing its output, it determines whether a download attempt succeeded by checking the desired result directly: is the simulator runtime actually installed and available afterwards (viaxcrun simctl list runtimes)? This is the same kind of check already used incheck_old_simulators. The helper is used for all three-downloadPlatformcall sites.Fixes #26288
🤖 Pull request created by Copilot