diff --git a/README.md b/README.md index 99368ab21a6ef1c8084fbe4f4f648473b26910c5..8e3799ae9d8c2f883f0e5b5c35099e61952ad874 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Moodle DTA Plugin CI/CD Automation Pipeline -[![pipeline status](https://gitlab.com/your-username/your-project/badges/master/pipeline.svg)](https://gitlab.com/your-username/your-project/-/commits/master) - This repository contains the complete infrastructure and automation scripts for a Continuous Integration (CI) pipeline designed to test a custom Moodle assignment submission plugin, the "Dockerized Testing Agent" (DTA). The primary goal of this project is to create a fully automated, ephemeral Moodle environment where the DTA plugin can be installed, configured, and tested from a clean slate on every code change, ensuring high-quality and reliable development. @@ -14,7 +12,7 @@ This project uses a combination of modern DevOps tools to achieve a fully automa * **Containerization:** **Docker** and **Docker Compose** are used to define and run the multi-container application stack (Moodle, MariaDB, and the custom DTA Backend). * **Custom Moodle Image:** A custom `Dockerfile` builds a Moodle image from a standard **Debian 'Bookworm'** base. This provides a clean, non-opinionated foundation and allows for precise control over PHP versions and system dependencies, which proved critical after initial attempts with pre-packaged images failed. -* **Orchestration Scripting:** A master `bash` script (`automate_moodle.sh`) orchestrates the entire lifecycle, from Moodle's command-line installation to the final student submission. +* **Orchestration Scripting:** A master `bash` script (`test-moodle.sh`) orchestrates the entire lifecycle, from Moodle's command-line installation to the final student submission. * **Deep Moodle Integration:** Custom **PHP CLI scripts** are generated on the fly to interact directly with Moodle's core internal libraries. This robust method was developed to bypass limitations and bugs in the standard Moodle Web Service API for complex tasks like assignment creation and submission. * **CI/CD Pipeline:** The entire process is designed to be executed within a **GitLab CI/CD** pipeline, using a `.gitlab-ci.yml` file to define the stages, manage secrets, and automate the workflow. @@ -28,7 +26,7 @@ Here is a description of the key files in this repository: | :----------------------------- | :----------------------------------------------------------------------------------------------------- | | **`docker-compose.yml`** | Defines all the services (Moodle, DB, DTA Backend), networks, and volumes for the application stack. | | **`Dockerfile`** | The blueprint for building our custom, transparent Moodle web server image based on Debian. | -| **`automate_moodle.sh`** | The master orchestration script that runs the entire end-to-end process after the containers are started. | +| **`test-moodle.sh`** | The master orchestration script that runs the entire end-to-end process after the containers are started. | | **`docker-entrypoint.sh`** | A helper script used inside the `Dockerfile` to ensure Apache starts correctly. | | **`dta.zip`** | The Moodle assignment submission plugin to be tested. | | **`dta_teacher_config.zip`** | A sample configuration file used by the script to set up the DTA assignment. | @@ -53,8 +51,8 @@ Follow these steps to build and run the entire automation pipeline on your local 1. **Clone the Repository:** ```bash - git clone [your-repository-url] - cd [your-repository-directory] + git clone https://transfer.hft-stuttgart.de/gitlab/cota/cota-infra + cd cota-infra ``` 2. **Build and Start the Containers:** @@ -66,13 +64,13 @@ Follow these steps to build and run the entire automation pipeline on your local 3. **Make the Script Executable:** ```bash - chmod +x automate_moodle.sh + chmod +x test-moodle.sh ``` 4. **Configure and Run the Automation Script:** - Before running, open `automate_moodle.sh` in a text editor and ensure the credentials at the top (e.g., `MOODLE_ADMIN_PASS`) match what you intend to use. Then, execute the script: + Before running, open `test-moodle.sh` in a text editor and ensure the credentials at the top (e.g., `MOODLE_ADMIN_PASS`) match what you intend to use. Then, execute the script: ```bash - ./automate_moodle.sh + ./test-moodle.sh ``` The script will now run through all the automated steps: installing the plugin, creating users and roles, configuring the web service, creating the course and assignment, and finally simulating a student submission and checking the results. @@ -91,6 +89,6 @@ This project is designed to be run in a CI/CD environment like GitLab. The `.git 1. **Setup:** A GitLab Runner with Docker capabilities will check out the code. 2. **Environment Launch:** The runner will execute `docker-compose up -d --build` to create a fresh Moodle environment for the test run. -3. **Automation:** The runner will then execute the `automate_moodle.sh` script. Secret credentials (like `MOODLE_ADMIN_PASS`) will be injected securely from GitLab's CI/CD variables, not stored in the script itself. +3. **Automation:** The runner will then execute the `test-moodle.sh` script. Secret credentials (like `MOODLE_ADMIN_PASS`) will be injected securely from GitLab's CI/CD variables, not stored in the script itself. 4. **Testing:** After the automation script successfully sets up the test scenario, the pipeline would proceed to run tests against the DTA plugin and its backend. 5. **Teardown:** The `after_script` stage in GitLab will automatically run `docker-compose down -v` to ensure the environment is completely destroyed, leaving the runner clean for the next job.