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 @@ ...@@ -3,21 +3,16 @@
image: docker:20.10.16 image: docker:20.10.16
services:
- name: docker:20.10.16-dind
alias: docker
stages: stages:
- full_test - full_test
variables: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: unix:///var/run/docker.sock
DOCKER_TLS_CERTDIR: "" DOCKER_TLS_CERTDIR: ""
EUSER: "appuser" EUSER: "appuser"
EGID: "999" EGID: "999"
MOODLE_WWWROOT: "http://docker:8080" # For the entrypoint installation MOODLE_WWWROOT: "http://localhost:8080" # Updated to localhost for Docker socket
MOODLE_URL: "http://docker:8080" # For the test script's curl commands MOODLE_URL: "http://localhost:8080" # Updated to localhost for test script
# Add the admin credentials here so they are also written to the .env file
MOODLE_ADMIN_USER: "user" MOODLE_ADMIN_USER: "user"
MOODLE_ADMIN_PASS: "QAYwsx@12345" MOODLE_ADMIN_PASS: "QAYwsx@12345"
...@@ -27,31 +22,22 @@ run_full_automation: ...@@ -27,31 +22,22 @@ run_full_automation:
before_script: before_script:
- apk add --no-cache curl docker-compose bash jq - 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 - echo "Verifying Docker daemon..."
- docker info || { echo "Failed to connect to Docker daemon!"; exit 1; }
# --- THIS IS THE FIX --- - echo "Setting up named volume..."
# 1. Explicitly create the named volume so we know it exists.
- docker volume create cota-infra_dta_tests_data - 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..." - echo "Setting permissions on dta_tests_data volume..."
- docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data - docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data
script: 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 "Creating .env file for Docker Compose..."
- echo "MOODLE_WWWROOT=${MOODLE_WWWROOT}" > .env - echo "MOODLE_WWWROOT=${MOODLE_WWWROOT}" > .env
- echo "MOODLE_ADMIN_USER=${MOODLE_ADMIN_USER}" >> .env - echo "MOODLE_ADMIN_USER=${MOODLE_ADMIN_USER}" >> .env
- echo "MOODLE_ADMIN_PASS=${MOODLE_ADMIN_PASS}" >> .env - echo "MOODLE_ADMIN_PASS=${MOODLE_ADMIN_PASS}" >> .env
- echo "EUSER=${EUSER}" >> .env - echo "EUSER=${EUSER}" >> .env
- echo "EGID=${EGID}" >> .env - echo "EGID=${EGID}" >> .env
- echo "Starting Docker environment..." - echo "Starting Docker environment..."
- docker-compose up -d - docker-compose up -d
# Loop until the Moodle installation is complete.
- echo "Waiting for Moodle first-time installation to complete..." - echo "Waiting for Moodle first-time installation to complete..."
- | - |
timeout=300 timeout=300
...@@ -66,8 +52,6 @@ run_full_automation: ...@@ -66,8 +52,6 @@ run_full_automation:
sleep 5 sleep 5
done done
- echo "✅ Moodle installation complete (config.php found)." - 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 - chmod +x test-moodle.sh
- echo "Executing the main automation script..." - echo "Executing the main automation script..."
- ./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