Commit e6b6178f authored by Abhishek's avatar Abhishek
Browse files

Update .gitlab-ci.yml file

parent 23ddb6e1
Pipeline #11826 failed with stage
in 1 minute and 41 seconds
...@@ -3,7 +3,6 @@ image: 41abku1mst/moodle-web:latest # your Moodle image in registry ...@@ -3,7 +3,6 @@ image: 41abku1mst/moodle-web:latest # your Moodle image in registry
stages: stages:
- full_test - full_test
# GitLab services: MariaDB + Backend
services: services:
- name: mariadb:10.6 - name: mariadb:10.6
alias: db alias: db
...@@ -23,34 +22,57 @@ variables: ...@@ -23,34 +22,57 @@ variables:
MARIADB_USER: moodleuser MARIADB_USER: moodleuser
MARIADB_PASSWORD: moodlepassword MARIADB_PASSWORD: moodlepassword
# Backend port (internal GitLab service network) # Backend URL
BACKEND_URL: "http://backend:8080" BACKEND_URL: "http://backend:8080"
run_full_automation: run_full_automation:
stage: full_test stage: full_test
script: script:
# 1. Start Apache in background # 1. Install curl + netcat if missing
- apt-get update && apt-get install -y curl netcat
# 2. Start Apache in background
- echo "🚀 Starting Apache..." - echo "🚀 Starting Apache..."
- apache2ctl -D FOREGROUND & - apache2ctl -D FOREGROUND &
- sleep 10 - sleep 10
# 2. Wait for MariaDB service # 3. Wait for MariaDB
- echo "⏳ Waiting for MariaDB..." - echo "⏳ Waiting for MariaDB..."
- timeout=180
- until mysqladmin ping -h"db" --silent; do - until mysqladmin ping -h"db" --silent; do
timeout=$((timeout - 5));
if [ $timeout -le 0 ]; then
echo "❌ MariaDB did not start after 3 minutes.";
exit 1;
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."
# 3. Wait for backend # 4. Wait for backend TCP port
- echo "⏳ Waiting for backend..." - echo "⏳ Waiting for backend:8080..."
- until curl -s -f -o /dev/null http://backend:8080/actuator/health; do - timeout=180
- until nc -z backend 8080; do
timeout=$((timeout - 5));
if [ $timeout -le 0 ]; then
echo "❌ Backend port 8080 not reachable after 3 minutes.";
exit 1;
fi;
echo " -> Backend not ready, retrying in 5s"; echo " -> Backend not ready, retrying in 5s";
sleep 5; sleep 5;
done done
- echo "✅ Backend is ready." - echo "✅ Backend port is open."
# 5. Try /actuator/health if available (non-blocking)
- echo "⏳ Checking backend health endpoint..."
- if curl -s -f $BACKEND_URL/actuator/health > /dev/null; then
echo "✅ Backend health endpoint OK";
else
echo "⚠️ Backend health endpoint not available, continuing anyway";
fi
# 4. Run Moodle + Backend orchestration # 6. Run Moodle orchestration
- echo "▶️ Running full Moodle 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