Skip to content

Commit 0d9baee

Browse files
committed
Repeat "hdiutil create" commands to avoid failures
Race conditions with XProtect on macos-13 can cause spurious failures for `hdiutil create` commands. As a work-around, try the `hdiutil create` command several times (up to 10), and only fail if the command fails each time. Signed-off-by: Patrick Avery <[email protected]>
1 parent 1e20f32 commit 0d9baee

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

packaging/CPackConfig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "$ENV{VERSION_MAJOR}")
1414
set(CPACK_PACKAGE_VERSION_MINOR "$ENV{VERSION_MINOR}")
1515
set(CPACK_PACKAGE_VERSION_PATCH "$ENV{VERSION_PATCH}")
1616
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
17+
set(CPACK_COMMAND_HDIUTIL "${CMAKE_CURRENT_LIST_DIR}/hdiutil_repeat.sh")
1718
set(CPACK_INSTALL_COMMANDS "python package.py -h $ENV{HEXRD_PACKAGE_CHANNEL} -o $ENV{HEXRDGUI_OUTPUT_FOLDER}" )
1819
set(CPACK_INSTALLED_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/package;/")
1920

packaging/hdiutil_repeat.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Workaround XProtect race condition for "hdiutil create" for MacOS 13
4+
5+
set -e
6+
7+
if [ "$1" != "create" ]; then
8+
# If it isn't an `hdiutil create` command, just run and exit normally
9+
hdiutil "$@"
10+
exit 0
11+
fi
12+
13+
# For an `hdiutil create` command, try repeatedly, up to 10 times
14+
# This prevents spurious errors caused by a race condition with XProtect
15+
# See https://github.com/actions/runner-images/issues/7522
16+
i=0
17+
until
18+
hdiutil "$@"
19+
do
20+
if [ $i -eq 10 ]; then exit 1; fi
21+
i=$((i+1))
22+
sleep 1
23+
done

0 commit comments

Comments
 (0)