Refactor Modocot Backend
This merge request fundamentally changes, how the modocot backend works.
What's changed (summary):
- no Gitea
- no webrequests from backend outgoing
- Jenkins only needed for building backend, but not for running it
- no more Jenkinsfiles or Dockerfiles in student submission repo needed
- what can be tested depends on what testrunner image a prof defines
Old workflow:
- prof submits new assignment as textfile in zip
- backend stores assignment repo
- clone
- delete git folder
- re-init new repo
- commit
- push to gitea for persistence
- student submits submission as textfile in zip
- backend puts assignment and submission together
- clone submission
- remove git folder
- clone assignment from gitea
- remove git folder
- copy together
- re-init repo
- commit
- push to gitea for testing
- backend triggers jenkins to run combined repo
- jenkins clones
- jenkins runs pipeline defined in student repo (security??!!)
- jenkins builds dockerimage defined in student repo (security??!!)
- jenkins runs dockerimage just built
- jennkins cleans up image/container after exit
- docker image runs test
- docker image makes web request to backend, delivering result
- backend returns result to moodle
New workflow
- prof submits new assignment as textfile
- backend stores assignment repo
- clone to persistent space inside docker container
- save submitted textfile
- student submits submission as textfile
- backend prepares test
- create temp dir
- copy saved assignment to temp dir
- clone student submission to temp dir
- define docker bind-mounts for assignment, submission and empty result folder
- backend pulls docker image for prof defined testrunner
- backend runs container, with pulled image and defined bind-mounts
- backend parses result file testrunner left on mounted result folder
- send result to moodle
New Usage from Prof/Student view
-
The upload has to be a plain textfile, no longer a zipped one
-
repo url and possible credentials no longer reside in seperte lines.
Instead a new modocot URI is defined:assignment:
modocot::<repo http url>::<username>::<password>::<docker image:tag>
submission:
modocot::<repo http url>::<username>::<password>
-
How the test is done and what's possible, no longer depends on the backend or the student repo to hold any complicated stuff that's greek to them:
The professor defines an Testrunner image, responsible for testing and delivering a normed result.json
For now one Testrunner is provided yet, able to run JUnit5/Jupiter tests that don't any additional libraries.
Provided Java Testrunner
The newly provided Testrunner runs with openjdk:11-jdk-slim as base image and JUnit5 5.7.0 libraries.
The assignment and submission are allowed to use a package structure now.
New Usage in Running this backend
To run this backend container you only need docker and mount the docker socket and a dedicated directory in temp to the container.
To listen for incoming assignment and submission request it needs an port mapping.
The previously needed setup, configuration and connection of backend, gitea and jenkins is gone.
News in development
The previously configured build job on Jenkins is disabled replaced by a mulit-branch configuration
The new Jenkinsfile does:
- pull repo
- package maven project
- build docker image
- push to docker hub with branch name as tag
Then, if the current build has a tag of format [0-9]+.[0-9]+.[0-9]+
:
- push just built image additionally with
- tag
latest
- tag of Git tag job runs on
- tag
What's left
- Documentation for the new state
- Unittests
-
figure out automatic build trigger on new multibranch pipeline (hadn't time yet to tinker around with this)(fixed)
Changelog
The changelog generated from standard-version if merged, would look like this:
2.0.0
⚠ BREAKING CHANGES
- pom: pom version bump to 2.0.0
- serializer def for Failure and Diagnostics removed
- removed lots of code, templates, etc
- rest: Gitea eliminated
- rest: Jenkins eliminated
- rest: expected file type changed from zip to text
- rest: textfile has to conform new modocot URI
- rest: no Jenkins pipe needed in submission repo
- rest: no Dockerfile needed in submission repo
- rest: file to be uploaded changed from zip to text
- rest: no longer uses Gitea
- util: method signature for cloneRepository changed
Features
-
config: add global proxy configuration (3a59600)
-
dev-templates: add compose file to build and run locally (73816f7)
-
model: add back model structure for moodle feedback (528d78e)
-
model: add new definition for a result file (d11a941)
-
util: added Docker Util (eebb44c)
-
util/FileUtil: add method for recursive folder copy (3042e11)
-
pom: bump version to 2.0.0 (aeed78a)
-
remove all old stuff, no longer used (1df2f5e)
-
removed custom serializer definition (ca3e0c7)
-
rest: refactor TaskUpload to V2 (db826d5)
-
rest: refactor UnitTestUpload to v2 (13d3ce3)
-
util: refactor JGitUtil for V2 (1547ce0)