Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeat "hdiutil create" commands to avoid failures #1768

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading