feat(workflows): implement timeout for pacman installation
This update introduces a timeout mechanism for the pacman installation process in the app builder workflow. If the installation does not complete within 30 minutes, it will terminate and log a timeout message, improving the robustness of the build process. - Adds a timeout for the pacman command to prevent indefinite hangs - Implements a heartbeat to monitor the installation progress - Provides clear error messages for timeout and failure scenarios
This commit is contained in:
@@ -160,10 +160,34 @@ jobs:
|
|||||||
|
|
||||||
for ARCH_INSTALL_ATTEMPT in 1 2 3; do
|
for ARCH_INSTALL_ATTEMPT in 1 2 3; do
|
||||||
echo "pacman attempt $ARCH_INSTALL_ATTEMPT of 3"
|
echo "pacman attempt $ARCH_INSTALL_ATTEMPT of 3"
|
||||||
if pacman -Syu --needed --noconfirm "${ARCH_PACKAGES[@]}"; then
|
timeout --signal=TERM 30m \
|
||||||
|
pacman -Syu --needed --noconfirm --noprogressbar \
|
||||||
|
"${ARCH_PACKAGES[@]}" \
|
||||||
|
</dev/null &
|
||||||
|
ARCH_PACMAN_PID=$!
|
||||||
|
(
|
||||||
|
ARCH_WAIT_SECONDS=0
|
||||||
|
while true; do
|
||||||
|
sleep 30
|
||||||
|
((ARCH_WAIT_SECONDS += 30))
|
||||||
|
echo "pacman is still running (${ARCH_WAIT_SECONDS}s elapsed)"
|
||||||
|
done
|
||||||
|
) &
|
||||||
|
ARCH_HEARTBEAT_PID=$!
|
||||||
|
|
||||||
|
ARCH_PACMAN_STATUS=0
|
||||||
|
wait "$ARCH_PACMAN_PID" || ARCH_PACMAN_STATUS=$?
|
||||||
|
kill "$ARCH_HEARTBEAT_PID" 2>/dev/null || true
|
||||||
|
wait "$ARCH_HEARTBEAT_PID" 2>/dev/null || true
|
||||||
|
|
||||||
|
if [ "$ARCH_PACMAN_STATUS" -eq 0 ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ARCH_PACMAN_STATUS" -eq 124 ]; then
|
||||||
|
echo "pacman attempt timed out after 30 minutes" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$ARCH_INSTALL_ATTEMPT" -eq 3 ]; then
|
if [ "$ARCH_INSTALL_ATTEMPT" -eq 3 ]; then
|
||||||
echo "pacman failed after 3 attempts" >&2
|
echo "pacman failed after 3 attempts" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user