Commit 7c595e7e authored by Abhishek's avatar Abhishek
Browse files

Update .gitlab-ci.yml file

parent ff17de03
Pipeline #11777 passed with stage
in 7 minutes and 52 seconds
# This GitLab CI/CD pipeline is designed to run the complete Moodle
# automation script in a single, manually triggered job.
# Use the official Docker image to enable Docker-in-Docker (dind).
# This allows us to run docker-compose inside the CI job.
image: docker:20.10.16 image: docker:20.10.16
services: services:
- name: docker:20.10.16-dind - name: docker:20.10.16-dind
alias: docker # This alias is important for the runner to find the Docker daemon. alias: docker
stages: stages:
- full_test # A single stage for our end-to-end test. - full_test
variables: variables:
# --- FIX STARTS HERE ---
# 1. DOCKER_HOST tells docker-compose how to connect to the Docker-in-Docker service.
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
# 2. EUSER and EGID provide default values for the variables in your docker-compose.yml. DOCKER_TLS_CERTDIR: ""
EUSER: "1000" EUSER: "1000"
EGID: "1000" EGID: "1000"
# --- FIX ENDS HERE ---
# Define variables that will be available to the job.
MOODLE_URL: "http://docker:8080" MOODLE_URL: "http://docker:8080"
BACKEND_URL: "http://docker:8081" BACKEND_URL: "http://docker:8081"
# This variable is required for the Docker-in-Docker service to work correctly.
DOCKER_TLS_CERTDIR: "/certs"
# This is the main job that runs the entire script.
run_full_automation: run_full_automation:
stage: full_test stage: full_test
# 'when: manual' means this job will ONLY run when you click the
# "play" button for it in the GitLab CI/CD > Pipelines view.
when: manual when: manual
before_script: before_script:
# Install the necessary tools inside the Docker runner. - apk add --no-cache curl docker-compose bash jq
- apk add --update curl docker-compose jq bash - until docker info > /dev/null 2>&1; do echo "Waiting for Docker..."; sleep 3; done
script: script:
# 1. Start all the services defined in your docker-compose.yml file.
# The '-d' runs them in the background.
- echo "Starting Docker environment..." - echo "Starting Docker environment..."
- docker-compose up -d - docker-compose up -d
- echo "Waiting for Moodle..."
# 2. Wait for the Moodle container to fully initialize and run its entrypoint script.
# This is a simple but effective way to wait for the installation to finish.
- echo "Waiting 2 minutes for Moodle to install and start..."
- sleep 120 - sleep 120
# 3. Make your main script executable.
# Replace 'your_main_script.sh' with the actual filename.
- chmod +x your_main_script.sh - chmod +x your_main_script.sh
# 4. Run the entire script from top to bottom.
- echo "Executing the main automation script..."
- ./your_main_script.sh - ./your_main_script.sh
after_script: after_script:
# It's good practice to clean up the environment after the test.
- echo "Tearing down Docker environment..." - echo "Tearing down Docker environment..."
- docker-compose down - docker-compose down -v
\ No newline at end of file \ 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