Skip to content

Commit

Permalink
Merge pull request #1768 from HEXRD/fix-hdiutil-spurious-failures
Browse files Browse the repository at this point in the history
Repeat "hdiutil create" commands to avoid failures
  • Loading branch information
psavery authored Dec 18, 2024
2 parents 1e20f32 + 0d9baee commit 164b618
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions packaging/CPackConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "$ENV{VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "$ENV{VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "$ENV{VERSION_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_COMMAND_HDIUTIL "${CMAKE_CURRENT_LIST_DIR}/hdiutil_repeat.sh")
set(CPACK_INSTALL_COMMANDS "python package.py -h $ENV{HEXRD_PACKAGE_CHANNEL} -o $ENV{HEXRDGUI_OUTPUT_FOLDER}" )
set(CPACK_INSTALLED_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/package;/")

Expand Down
23 changes: 23 additions & 0 deletions packaging/hdiutil_repeat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Workaround XProtect race condition for "hdiutil create" for MacOS 13

set -e

if [ "$1" != "create" ]; then
# If it isn't an `hdiutil create` command, just run and exit normally
hdiutil "$@"
exit 0
fi

# For an `hdiutil create` command, try repeatedly, up to 10 times
# This prevents spurious errors caused by a race condition with XProtect
# See https://github.com/actions/runner-images/issues/7522
i=0
until
hdiutil "$@"
do
if [ $i -eq 10 ]; then exit 1; fi
i=$((i+1))
sleep 1
done

0 comments on commit 164b618

Please sign in to comment.