Continuous integration for student assignments

TL;DR: yes, what you want to do it feasible, and you're already looking at the correct tools.


What you want seems totally feasible: install the Git plugin for Jenkins, configure it to track each branches of the repo, and it's already possible to launch a build after each push.

Since you can execute arbitrary scripts during a Jenkins build, you can give push permissions to the Jenkins user, and have it merge and push the code if all tests pass.

You can then also install a sonar server, and call it through the Sonar plugin, and your students will get this additional feedback.

On the other hand, Gerrit might be a little overkill for what you're looking for. Or rather: it's a valuable tool, but I believe you don't need it for the first iteration.

I can think of two types of difficulties:

  1. Scripting / Corner cases
  2. Whether you want to prevent student from gaming the system

For (1), I mean that you'll need to implement your rules (for example "only build the subfolder which belong to the last commiter" ; "don't build merge commits on master" ; ...). And you'll likely run into issues such that:

  • You don't want a new Jenkins run on a merge commit just pushed by a Jenkins job, so you'll have to take it into account in your build script
  • What if you want to allow several Jenkins run at the same time, and two runs tries to merge and push at the same time

I guess you'll just need to fix those glitches as you'll discover them. Just think about creating backups of your Jenkins config (you might as well store them in an ad hoc git repo).

For (2), I mean that you might want to take into account, for example, the case where a student would delete from the repo the tests his implementation can't pass. Or the case of the student who would directly push on master.

I believe you could add lot of checks to prevent this kind of cheating, however, rather than entering into a "technological conflict", I guess it would be more healthy to just tell them you trust them.