Commit c4673e13 authored by Abhishek's avatar Abhishek
Browse files

Update .gitlab-ci.yml file

parent ecaca0f1
Pipeline #11818 passed with stage
in 18 seconds
......@@ -3,21 +3,16 @@
image: docker:20.10.16
services:
- name: docker:20.10.16-dind
alias: docker
stages:
- full_test
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_HOST: unix:///var/run/docker.sock
DOCKER_TLS_CERTDIR: ""
EUSER: "appuser"
EGID: "999"
MOODLE_WWWROOT: "http://docker:8080" # For the entrypoint installation
MOODLE_URL: "http://docker:8080" # For the test script's curl commands
# Add the admin credentials here so they are also written to the .env file
MOODLE_WWWROOT: "http://localhost:8080" # Updated to localhost for Docker socket
MOODLE_URL: "http://localhost:8080" # Updated to localhost for test script
MOODLE_ADMIN_USER: "user"
MOODLE_ADMIN_PASS: "QAYwsx@12345"
......@@ -27,31 +22,22 @@ run_full_automation:
before_script:
- apk add --no-cache curl docker-compose bash jq
- until docker info > /dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 3; done
# --- THIS IS THE FIX ---
# 1. Explicitly create the named volume so we know it exists.
- echo "Verifying Docker daemon..."
- docker info || { echo "Failed to connect to Docker daemon!"; exit 1; }
- echo "Setting up named volume..."
- docker volume create cota-infra_dta_tests_data
# 2. Run a temporary container that mounts this volume and changes the ownership
# of the directory to user 137, which is the 'appuser' inside the backend container.
- echo "Setting permissions on dta_tests_data volume..."
- docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data
script:
# --- THIS IS THE FIX ---
# Create a .env file on the fly. Docker Compose will automatically read this
# file and pass the variables to the containers.
- echo "Creating .env file for Docker Compose..."
- echo "MOODLE_WWWROOT=${MOODLE_WWWROOT}" > .env
- echo "MOODLE_ADMIN_USER=${MOODLE_ADMIN_USER}" >> .env
- echo "MOODLE_ADMIN_PASS=${MOODLE_ADMIN_PASS}" >> .env
- echo "EUSER=${EUSER}" >> .env
- echo "EGID=${EGID}" >> .env
- echo "Starting Docker environment..."
- docker-compose up -d
# Loop until the Moodle installation is complete.
- echo "Waiting for Moodle first-time installation to complete..."
- |
timeout=300
......@@ -66,12 +52,10 @@ run_full_automation:
sleep 5
done
- echo "✅ Moodle installation complete (config.php found)."
# Now that Moodle is stable, we can proceed with the rest of the script.
- chmod +x test-moodle.sh
- echo "Executing the main automation script..."
- ./test-moodle.sh
after_script:
- echo "Tearing down Docker environment..."
- docker-compose down -v
- docker-compose down -v
\ No newline at end of file
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