Skip to content

Commit

Permalink
Retry generating Windows launchers in the generate-native-image.sh
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Gedochao authored Dec 6, 2024
1 parent b60ea03 commit 1e3746b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
30 changes: 28 additions & 2 deletions .github/scripts/generate-native-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,34 @@ if [[ "$OSTYPE" == "msys" ]]; then
export GRAALVM_HOME="$JAVA_HOME"
export PATH="$(pwd)/bin:$PATH"
echo "PATH=$PATH"
./mill.bat -i "$COMMAND" generate-native-image.bat ""
./generate-native-image.bat

# this part runs into connection problems on Windows, so we retry up to 5 times
MAX_RETRIES=5
RETRY_COUNT=0
while (( RETRY_COUNT < MAX_RETRIES )); do
./mill.bat -i "$COMMAND" generate-native-image.bat ""

if [[ $? -ne 0 ]]; then
echo "Error occurred during 'mill.bat -i $COMMAND generate-native-image.bat' command. Retrying... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"
(( RETRY_COUNT++ ))
sleep 2
else
./generate-native-image.bat
if [[ $? -ne 0 ]]; then
echo "Error occurred during 'generate-native-image.bat'. Retrying... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"
(( RETRY_COUNT++ ))
sleep 2
else
echo "'generate-native-image.bat' succeeded with $RETRY_COUNT retries."
break
fi
fi
done

if (( RETRY_COUNT == MAX_RETRIES )); then
echo "Exceeded maximum retry attempts. Exiting with error."
exit 1
fi
else
if [ $# == "0" ]; then
if [[ "$OSTYPE" == "linux-gnu" ]]; then
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -814,12 +814,8 @@ jobs:
run: .github/scripts/get-latest-cs.sh
shell: bash
- name: Generate native launcher
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 5
shell: bash
command: .github/scripts/generate-native-image.sh
run: .github/scripts/generate-native-image.sh
shell: bash
- run: ./mill -i ci.setShouldPublish
- name: Build OS packages
if: env.SHOULD_PUBLISH == 'true'
Expand Down

0 comments on commit 1e3746b

Please sign in to comment.