Commit 3358edf7 authored by Abhishek's avatar Abhishek
Browse files

Update .gitlab-ci.yml file

parent 04903631
Pipeline #11981 skipped with stage
......@@ -4,10 +4,7 @@ services:
- name: docker:20.10.16-dind
stages:
- setup
- install_plugin
- teacher_workflow
- student_workflow
- full_test
variables:
DOCKER_HOST: tcp://docker:2375
......@@ -24,8 +21,8 @@ variables:
DTA_CONFIG_FILE: "teacher-dta-dir-test-runner-jdk21.txt"
DTA_STUDENT_SUBMISSION_FILE: "student-dir.txt"
setup_environment:
stage: setup
run_full_automation:
stage: full_test
when: manual
before_script:
- apk add --no-cache curl bash jq bind-tools
......@@ -38,70 +35,33 @@ setup_environment:
- echo "Setting permissions on dta_tests_data volume..."
- docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data
script:
- 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
- apk add --no-cache curl bash jq git bind-tools
- docker volume create cota-infra_dta_tests_data
- docker run --rm -v cota-infra_dta_tests_data:/data alpine chown 137:137 /data
- echo "Creating .env..."
- echo "MOODLE_WWWROOT=http://docker:8080" > .env
- echo "MOODLE_ADMIN_USER=user" >> .env
- echo "MOODLE_ADMIN_PASS=QAYwsx@12345" >> .env
- echo "EUSER=appuser" >> .env
- echo "EGID=137" >> .env
- echo "Starting Docker environment..."
- docker compose up -d
- echo "Waiting for Moodle first-time installation to complete..."
- echo "Waiting for Moodle installation..."
- |
timeout=300
while ! docker exec moodle-web-official [ -f /var/www/html/config.php ]; do
timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then
echo "❌ ERROR: Moodle installation timed out after 5 minutes."
docker logs moodle-web-official
echo "❌ Moodle installation timed out"
docker ps -a
exit 1
fi
echo " -> Installation not yet complete, waiting 5 more seconds..."
echo " -> Not ready, waiting..."
sleep 5
done
- echo "✅ Moodle installation complete (config.php found)."
artifacts:
paths:
- .env
expire_in: 1 hour
# 🧩 Stage 1: Install and activate plugin inside Moodle container
install_plugin:
stage: install_plugin
needs: [setup_environment]
script:
- source .env
- apk add --no-cache bash curl jq git
- echo "✅ Moodle ready!"
- bash ./script_step1.sh
artifacts:
paths:
- .env
expire_in: 1 hour
# 🧩 Stage 2: Teacher workflow — creates course, assignment, and saves outputs
teacher_workflow:
stage: teacher_workflow
script:
- apk add --no-cache bash curl jq git
- echo "Running teacher workflow..."
- bash ./script_step2.sh
artifacts:
paths:
- .env # Contains course_id, assignment_id, etc.
expire_in: 1 day
needs:
- job: install_plugin
artifacts: true
# 🧩 Stage 3: Student workflow — uses env values from Stage 2
student_workflow:
stage: student_workflow
script:
- apk add --no-cache bash curl jq git
- echo "Running student submission workflow..."
- bash ./script_step3.sh
needs:
- job: teacher_workflow
artifacts: true
when: manual # You can run it manually if needed
- bash ./script_step3.sh
\ 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