Commit 71c56e9b authored by Abhishek's avatar Abhishek
Browse files

Update .gitlab-ci.yml file

parent f185eb0e
Pipeline #11829 failed with stage
in 1 minute and 50 seconds
...@@ -28,54 +28,51 @@ variables: ...@@ -28,54 +28,51 @@ variables:
run_full_automation: run_full_automation:
stage: full_test stage: full_test
script: script:
# 1. Install curl + netcat-openbsd
- apt-get update && apt-get install -y curl netcat-openbsd - apt-get update && apt-get install -y curl netcat-openbsd
# 2. Start Apache in background
- echo "🚀 Starting Apache..." - echo "🚀 Starting Apache..."
- apache2ctl -D FOREGROUND & - apache2ctl -D FOREGROUND &
- sleep 10 - sleep 10
# 3. Wait for MariaDB
- echo "⏳ Waiting for MariaDB..." - echo "⏳ Waiting for MariaDB..."
- timeout=180 - timeout=180
- until mysqladmin ping -h"db" --silent; do - |
timeout=$((timeout - 5)); until mysqladmin ping -h"db" --silent; do
timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then if [ $timeout -le 0 ]; then
echo "❌ MariaDB did not start after 3 minutes."; echo "❌ MariaDB did not start after 3 minutes."
exit 1; exit 1
fi; fi
echo " -> DB not ready, retrying in 5s"; echo " -> DB not ready, retrying in 5s"
sleep 5; sleep 5
done done
- echo "✅ MariaDB is ready." - echo "✅ MariaDB is ready."
# 4. Wait for backend TCP port
- echo "⏳ Waiting for backend:8080..." - echo "⏳ Waiting for backend:8080..."
- timeout=180 - timeout=180
- until nc -z backend 8080; do - |
timeout=$((timeout - 5)); until nc -z backend 8080; do
timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then if [ $timeout -le 0 ]; then
echo "❌ Backend port 8080 not reachable after 3 minutes."; echo "❌ Backend port 8080 not reachable after 3 minutes."
exit 1; exit 1
fi; fi
echo " -> Backend not ready, retrying in 5s"; echo " -> Backend not ready, retrying in 5s"
sleep 5; sleep 5
done done
- echo "✅ Backend port is open." - echo "✅ Backend port is open."
# 5. Try /actuator/health if available (non-blocking)
- echo "⏳ Checking backend health endpoint..." - echo "⏳ Checking backend health endpoint..."
- if curl -s -f $BACKEND_URL/actuator/health > /dev/null; then - |
echo "✅ Backend health endpoint OK"; if curl -s -f $BACKEND_URL/actuator/health >/dev/null; then
echo "✅ Backend health endpoint OK"
else else
echo "⚠️ Backend health endpoint not available, continuing anyway"; echo "⚠️ Backend health endpoint not available, continuing anyway"
fi fi
# Wait for Moodle to become live
- echo "⏳ Waiting for Moodle to be ready..."
- timeout=300 - timeout=300
- until curl -s -f http://localhost >/dev/null; do - echo "⏳ Waiting for Moodle web server to be ready..."
- |
until curl -s -f http://localhost >/dev/null; do
timeout=$((timeout - 5)) timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then if [ $timeout -le 0 ]; then
echo "❌ Moodle did not become ready in 5 minutes" echo "❌ Moodle did not become ready in 5 minutes"
...@@ -86,6 +83,6 @@ run_full_automation: ...@@ -86,6 +83,6 @@ run_full_automation:
done done
- echo "✅ Moodle is live" - echo "✅ Moodle is live"
# Now run the automation - echo "▶️ Running Moodle automation..."
- chmod +x test-moodle.sh - chmod +x test-moodle.sh
- ./test-moodle.sh - ./test-moodle.sh
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment