Skip to content

[CI] Retry simulator runtime downloads on transient network failures. Fixes #26288 - #26406

Merged
rolfbjarne merged 2 commits into
mainfrom
dev/rolf/issue-26288-ci-apple-simulator-runtime-downloads-ti-469f81
Aug 6, 2026
Merged

[CI] Retry simulator runtime downloads on transient network failures. Fixes #26288#26406
rolfbjarne merged 2 commits into
mainfrom
dev/rolf/issue-26288-ci-apple-simulator-runtime-downloads-ti-469f81

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

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.

This adds 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. The helper is used for all three -downloadPlatform call sites.

Fixes #26288

🤖 Pull request created by Copilot

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
Copilot AI review requested due to automatic review settings August 5, 2026 14:59
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner August 5, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_installed to verify a given simulator runtime is present/available using xcrun simctl list runtimes + jq.
  • Added xcodebuild_download_platform helper to retry platform downloads up to 5 times, sleeping 15s between attempts, and verifying installation after each attempt.
  • Switched existing -downloadPlatform call sites to use the retry helper.

Comment thread system-dependencies.sh Outdated
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

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
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 1ae6acd3d4f2ebaedd1997d53667df126d79cefb [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [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
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 1ae6acd3d4f2ebaedd1997d53667df126d79cefb [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) August 6, 2026 06:10
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Aug 6, 2026
@rolfbjarne
rolfbjarne merged commit f7920a5 into main Aug 6, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/issue-26288-ci-apple-simulator-runtime-downloads-ti-469f81 branch August 6, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Apple simulator runtime downloads time out with curl (56)

4 participants