Skip to content

Commit 1e3746b

Browse files
authored
Retry generating Windows launchers in the generate-native-image.sh script directly, rather than the entire CI step (#3350)
* Revert "Retry generating windows launcher up to 5 times (#3349)" This reverts commit 58d4da8. * Retry generating Windows launchers in the `generate-native-image.sh` script directly, rather than the entire CI step
1 parent b60ea03 commit 1e3746b

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

.github/scripts/generate-native-image.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,34 @@ if [[ "$OSTYPE" == "msys" ]]; then
1515
export GRAALVM_HOME="$JAVA_HOME"
1616
export PATH="$(pwd)/bin:$PATH"
1717
echo "PATH=$PATH"
18-
./mill.bat -i "$COMMAND" generate-native-image.bat ""
19-
./generate-native-image.bat
18+
19+
# this part runs into connection problems on Windows, so we retry up to 5 times
20+
MAX_RETRIES=5
21+
RETRY_COUNT=0
22+
while (( RETRY_COUNT < MAX_RETRIES )); do
23+
./mill.bat -i "$COMMAND" generate-native-image.bat ""
24+
25+
if [[ $? -ne 0 ]]; then
26+
echo "Error occurred during 'mill.bat -i $COMMAND generate-native-image.bat' command. Retrying... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"
27+
(( RETRY_COUNT++ ))
28+
sleep 2
29+
else
30+
./generate-native-image.bat
31+
if [[ $? -ne 0 ]]; then
32+
echo "Error occurred during 'generate-native-image.bat'. Retrying... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"
33+
(( RETRY_COUNT++ ))
34+
sleep 2
35+
else
36+
echo "'generate-native-image.bat' succeeded with $RETRY_COUNT retries."
37+
break
38+
fi
39+
fi
40+
done
41+
42+
if (( RETRY_COUNT == MAX_RETRIES )); then
43+
echo "Exceeded maximum retry attempts. Exiting with error."
44+
exit 1
45+
fi
2046
else
2147
if [ $# == "0" ]; then
2248
if [[ "$OSTYPE" == "linux-gnu" ]]; then

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -814,12 +814,8 @@ jobs:
814814
run: .github/scripts/get-latest-cs.sh
815815
shell: bash
816816
- name: Generate native launcher
817-
uses: nick-fields/retry@v3
818-
with:
819-
timeout_minutes: 30
820-
max_attempts: 5
821-
shell: bash
822-
command: .github/scripts/generate-native-image.sh
817+
run: .github/scripts/generate-native-image.sh
818+
shell: bash
823819
- run: ./mill -i ci.setShouldPublish
824820
- name: Build OS packages
825821
if: env.SHOULD_PUBLISH == 'true'

0 commit comments

Comments
 (0)