Files
purchases-ios/scripts/wait-for-ios-runtime.sh
Rick ff6ac714db Fix iOS 14.5 simulator runtime install hanging in CI (#6513)
* Add retry logic for simulator runtime installation

* Refactor iOS 14 runtime install to use reusable install-runtime command

* Revert "Refactor iOS 14 runtime install to use reusable install-runtime command"

This reverts commit 0aa54ecd26cc911e14f5b79626abaadefebd7444.

* Add timeout and retry logic to background iOS 14.5 runtime installation

* Remove unused install-runtime command

* Reduce per-attempt install timeout to 180s

* Temporarily isolate iOS 15/14 job and set 5s timeout to test retry logic

* Dump install log on success in wait step

* Stream install log in wait step instead of custom logging

* Force first 2 attempts to fail for testing retry logic

* Force first 2 attempts to timeout instead of instant fail

* Revert testing changes, restore full workflow

* Extract runtime install scripts from CircleCI config

* Fix orphaned process and set -e issues in install script
2026-03-25 11:45:18 +01:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
#
# Waits for a background runtime installation to complete, streaming the install log.
#
# Usage:
# ./wait-for-runtime.sh [log-file] [ready-file] [failed-file] [max-wait]
#
# Example:
# ./wait-for-runtime.sh /tmp/runtime_install.log /tmp/runtime_ready /tmp/runtime_failed 1800
set -euo pipefail
LOG="${1:-/tmp/runtime_install.log}"
READY_FILE="${2:-/tmp/runtime_ready}"
FAILED_FILE="${3:-/tmp/runtime_failed}"
MAX_WAIT="${4:-1800}"
LINES_SHOWN=0
ELAPSED=0
while [ ! -f "$READY_FILE" ] && [ ! -f "$FAILED_FILE" ]; do
if [ "$ELAPSED" -ge "$MAX_WAIT" ]; then
echo "Timed out after ${MAX_WAIT}s waiting for runtime installation."
exit 1
fi
NEW_LINES=$(tail -n +$((LINES_SHOWN + 1)) "$LOG" 2>/dev/null | wc -l)
if [ "$NEW_LINES" -gt 0 ]; then
tail -n +$((LINES_SHOWN + 1)) "$LOG" 2>/dev/null
LINES_SHOWN=$((LINES_SHOWN + NEW_LINES))
fi
sleep 10
ELAPSED=$((ELAPSED + 10))
done
# Print any remaining lines
tail -n +$((LINES_SHOWN + 1)) "$LOG" 2>/dev/null
if [ -f "$FAILED_FILE" ]; then
exit 1
fi