[CI] Make the hdiutil retry wrapper report failure (#7643)

* [CI] Make the hdiutil retry wrapper report failure

CPack reads the wrapper's exit status to decide whether the disk image was
created, so a zero exit turns a failed hdiutil into a later "Problem copying
the package" error that hides hdiutil's own message.

- Propagate hdiutil's real status instead of collapsing every failure to 1.
- Name the failing subcommand (create/attach/detach/convert) so the message
  says which CPack step gave up.
- Count attempts rather than failures in the retry line.

* Update .ci/compile.sh

Co-authored-by: tooomm <tooomm@users.noreply.github.com>

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: tooomm <tooomm@users.noreply.github.com>
This commit is contained in:
BruebachL 2026-11-02 07:01:55 +01:00 • committed by GitHub
parent 50a2ae9cc8
commit 5fe7f186d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -311,16 +311,24 @@ if [[ $RUNNER_OS == macOS ]]; then
if [[ $MAKE_PACKAGE ]]; then if [[ $MAKE_PACKAGE ]]; then
# Workaround https://github.com/actions/runner-images/issues/7522 # Workaround https://github.com/actions/runner-images/issues/7522
# have hdiutil repeat the command 10 times in hope of success # have hdiutil repeat the command 10 times in hope of success.
# The wrapper has to exit non-zero once it gives up: CPack reads that status to
# decide whether the disk image was created, so a zero exit turns a failed hdiutil
# into a much later, misleading "Problem copying the package" error that hides
# hdiutil's own message.
hdiutil_script="/tmp/hdiutil.sh" hdiutil_script="/tmp/hdiutil.sh"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
echo '#!/bin/bash echo '#!/bin/bash
attempts=10
i=0 i=0
while ! hdiutil "$@"; do while true; do
if (( ++i >= 10 )); then hdiutil "$@" && exit 0
echo "Error: hdiutil failed $i times!" >&2 rc=$?
break if (( ++i >= attempts )); then
echo "::error::hdiutil $1 failed $i times (last status $rc), giving up" >&2
exit "$rc"
fi fi
echo "hdiutil $1 attempt $i/$attempts failed (status $rc), retrying" >&2
sleep 1 sleep 1
done' >"$hdiutil_script" done' >"$hdiutil_script"
chmod +x "$hdiutil_script" chmod +x "$hdiutil_script"