Skip to content

Commit

Permalink
improved retry logic for trivy scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
fqjony committed Sep 24, 2024
1 parent 5b1ffe4 commit 55c4544
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
set -e
# Retry logic for Trivy
max_retries=3
max_retries=5
attempt=1
success=false
Expand All @@ -59,13 +59,13 @@ jobs:
break
fi

# If the attempt fails, wait for 30 seconds before retrying
echo "Trivy scan failed, retrying in 30 seconds..."
sleep 30
# If the attempt fails, wait for 2 minutes before retrying
echo "Trivy scan failed, retrying in 2 minutes..."
sleep 120
attempt=$((attempt+1))
done

if [ "$success" = false ]; then
echo "Failed to complete Trivy scan after $max_retries attempts."
exit 1
fi
fi

0 comments on commit 55c4544

Please sign in to comment.