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

(fix) colima: fix return code handling (followup to #3097) #3106

Merged
merged 20 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
changed logging to github-style. maybe this finally shows up.
  • Loading branch information
tobitege committed Jul 25, 2024
commit a2a782b6ad6d732db98d3dd7b92458e48c0ea74b
28 changes: 17 additions & 11 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:

env:
PERSIST_SANDBOX : "false"
ACTIONS_RUNNER_DEBUG: "true" # Enable runner debug logging
ACTIONS_STEP_DEBUG: "true" # Enable step debug logging

jobs:
fe-test:
Expand Down Expand Up @@ -93,47 +95,51 @@ jobs:
# Find a free port in the range 10000-20000
RANDOM_PORT=$((RANDOM % 10001 + 10000))

echo "Using random port: $RANDOM_PORT for SSH"
echo "::group::Colima Start Attempt"
echo "::debug::Using random port: $RANDOM_PORT for SSH"

if ! colima start --network-address --arch x86_64 --cpu=1 --memory=1 --verbose --ssh-port $RANDOM_PORT; then
echo "Failed to start Colima."
echo "::error::Failed to start Colima."
return 1
fi
echo "::endgroup::"
}

# Attempt to start Colima; 4 retries:
tobitege marked this conversation as resolved.
Show resolved Hide resolved
ATTEMPT_LIMIT=5
for ((i=1; i<=ATTEMPT_LIMIT; i++)); do
if start_colima; then
echo "Colima started successfully."
echo "::notice::Colima started successfully."
break
else
echo "Failed to start Colima. Attempt $i/$ATTEMPT_LIMIT."
echo "Colima logs:"
echo "::warning::Failed to start Colima. Attempt $i/$ATTEMPT_LIMIT."
echo "::group::Colima logs"
if [ -f /opt/homebrew/var/log/colima.log ]; then
cat /opt/homebrew/var/log/colima.log
else
echo "Colima log file not found at /opt/homebrew/var/log/colima.log"
echo "::warning::Colima log file not found at /opt/homebrew/var/log/colima.log"
ls -l /opt/homebrew/var/log/
fi
echo "::endgroup::"
if [ $i -lt $ATTEMPT_LIMIT ]; then
echo "Stopping Colima forcefully..."
echo "::debug::Stopping Colima forcefully..."
colima stop -f
echo "Waiting 10 seconds before next attempt..."
echo "::debug::Waiting 10 seconds before next attempt..."
sleep 10
fi
fi
done

if [ $i -eq $ATTEMPT_LIMIT ]; then
echo "Failed to start Colima after $ATTEMPT_LIMIT attempts."
echo "Final Colima logs:"
echo "::error::Failed to start Colima after $ATTEMPT_LIMIT attempts."
echo "::group::Final Colima logs"
if [ -f /opt/homebrew/var/log/colima.log ]; then
cat /opt/homebrew/var/log/colima.log
else
echo "Colima log file not found at /opt/homebrew/var/log/colima.log"
echo "::warning::Colima log file not found at /opt/homebrew/var/log/colima.log"
ls -l /opt/homebrew/var/log/
fi
echo "::endgroup::"
exit 1
fi

Expand Down