Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CoTA
cota-infra
Commits
8c7a0d66
Commit
8c7a0d66
authored
Oct 09, 2025
by
Abhishek
Browse files
Update .gitlab-ci.yml file
parent
0fe31880
Pipeline
#11970
failed with stages
in 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
8c7a0d66
# This GitLab CI/CD pipeline is designed to run the complete Moodle
# automation script in a single, manually triggered 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
stages
:
stages
:
-
full_test
-
plugin_install
-
teacher_workflow
-
student_workflow
variables
:
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
"
"
DOCKER_TLS_CERTDIR
:
"
"
EUSER
:
"
appuser"
EUSER
:
"
appuser"
EGID
:
"
137"
EGID
:
"
137"
MOODLE_WWWROOT
:
"
http://docker:8080"
# For the entrypoint installation
MOODLE_
URL
:
"
http://docker:8080"
# For the test script's curl commands
MOODLE_
WWWROOT
:
"
http://docker:8080"
# Add the admin credentials here so they are also written to the .env file
MOODLE_URL
:
"
http://docker:8080"
MOODLE_ADMIN_USER
:
"
user"
MOODLE_ADMIN_USER
:
"
user"
MOODLE_ADMIN_PASS
:
"
QAYwsx@12345"
MOODLE_ADMIN_PASS
:
"
QAYwsx@12345"
run_full_automation
:
RUNNER_REPO
:
"
https://transfer.hft-stuttgart.de/gitlab/cota/examples/cota-runner-jdk21-junit5.git"
stage
:
full_test
DTA_CONFIG_FILE
:
"
teacher-dta-dir-test-runner-jdk21.txt"
when
:
manual
DTA_STUDENT_SUBMISSION_FILE
:
"
student-dir.txt"
before_script
:
-
apk add --no-cache curl bash jq bind-tools
-
echo "Checking DNS resolution..."
-
nslookup docker || getent hosts docker
-
echo "Checking Docker client and daemon..."
-
docker version
-
until docker info > /dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 3; done
# Explicitly create the named volume
# 🧩 Stage 1: Install and activate plugin inside Moodle container
-
docker volume create cota-infra_dta_tests_data
install_plugin
:
stage
:
plugin_install
# Fix permissions on the volume for appuser (UID 137)
-
echo "Setting permissions on dta_tests_data volume..."
-
docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data
script
:
script
:
# Create a .env file on the fly. Docker Compose will automatically read this
-
apk add --no-cache bash curl jq git
# file and pass the variables to the containers.
-
echo "Running plugin install script..."
-
echo "Creating .env file for Docker Compose..."
-
bash ./script_1_install_plugin.sh
-
echo "MOODLE_WWWROOT=${MOODLE_WWWROOT}" > .env
artifacts
:
-
echo "MOODLE_ADMIN_USER=${MOODLE_ADMIN_USER}" >> .env
paths
:
-
echo "MOODLE_ADMIN_PASS=${MOODLE_ADMIN_PASS}" >> .env
-
plugin_install.log
-
echo "EUSER=${EUSER}" >> .env
expire_in
:
1 day
-
echo "EGID=${EGID}" >> .env
# 🧩 Stage 2: Teacher workflow — creates course, assignment, and saves outputs
-
echo "Starting Docker environment..."
teacher_workflow
:
-
docker compose up -d
stage
:
teacher_workflow
script
:
# Loop until the Moodle installation is complete.
-
apk add --no-cache bash curl jq git
-
echo "Waiting for Moodle first-time installation to complete..."
-
echo "Running teacher workflow..."
-
|
-
bash ./script_2_teacher_workflow.sh
timeout=300
artifacts
:
while ! docker exec moodle-web-official [ -f /var/www/html/config.php ]; do
paths
:
timeout=$((timeout - 5))
-
.env
# Contains course_id, assignment_id, etc.
if [ $timeout -le 0 ]; then
expire_in
:
1 day
echo "❌ ERROR: Moodle installation timed out after 5 minutes."
needs
:
docker logs moodle-web-official
-
job
:
install_plugin
exit 1
artifacts
:
true
fi
echo " -> Installation not yet complete, waiting 5 more seconds..."
# 🧩 Stage 3: Student workflow — uses env values from Stage 2
sleep 5
student_workflow
:
done
stage
:
student_workflow
-
echo "✅ Moodle installation complete (config.php found)."
script
:
-
apk add --no-cache bash curl jq git
# Now that Moodle is stable, we can proceed with the rest of the script.
-
echo "Running student submission workflow..."
-
chmod +x test-moodle.sh
-
bash ./script_3_student_workflow.sh
-
echo "Executing the main automation script..."
needs
:
-
./test-moodle.sh
-
job
:
teacher_workflow
artifacts
:
true
after_script
:
when
:
manual
# You can run it manually if needed
-
echo "Tearing down Docker environment..."
-
docker-compose down -v
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment