Gitea: For classroom like GitHub

Created on 20 Mar 2020  Â·  30Comments  Â·  Source: go-gitea/gitea

Hi,
Do you plan to permit an usage like https://classroom.github.com/ ?

It'll be very good to have the possibility to create assignments and students to have their repositories created automatically when applying to the assignment.

For doing this like action (ci/cd, whatever), just having a webhook auto-assigned is perfect.

Regards

kinproposal

Most helpful comment

Also maybe this should be made as sepperate project and integrated in Gitea using API

All 30 comments

Sounds interesting.

If you have used it, could you write up task list that need to be implemented in Gitea?

I haven't used that but I think it should have the features.

  • A classroom could be binding to an organization.
  • Owners could create some assignments.
  • Owners could add students as members.
  • Students could view assignments and create a repository link to an assigment.
  • Students could pull and push codes from the assignment repository.
  • Owners could add review on the assignment repositories.

We could create three tables, classroom, assignment and student_assignment.

type Classroom struct {
    ID int64
    Name string
    OrgID int64
    StudentTeamID int64
    CreatorID int64
}

type Assignment struct {
    ID int64
    ClassroomID int64
    Name string
}

type StudentAssignment struct {
    ID int64
    AssignmentID int64
    StudentUserID int64
    RepoID int64
    Status AssignmentStatus
}

I haven't used it, just created a classroom to take screenshots.

So yes, a classroom is owned by an organization.

About running test and autograding, I think that adding score to StudentAssignment and having an API endpoint for our CI/CD to update that score could be great.

Another big deal, it's implementing LTI (https://github.com/education/classroom/issues/2350 & http://www.imsglobal.org/activity/learning-tools-interoperability) this can be useful.

Another thing is Group Assignment: https://imgur.com/a/Z6MiMOq

How are tests added for scoring?

Also maybe this should be made as sepperate project and integrated in Gitea using API

On GitHub it's like using GitHub Actions to run tests...
But using CI/CD can be a lot better if we can interact like that:

student apply for assignment 1:

  1. create repo using our start repo (like a fork or better like a copy/fake fork)
  2. Add webhook to our CI/CD job
  3. When push on master -> send to CI/CD
    We run the job, take repository username/repositoryname, run test and when finished, curl -XPOST final score sur l'api de gitea
  4. If scoring is >= $requiredminimalscore, green, show score and repository locked to read-only
    If not, red show score and repository still open to push

Big problem, attach the score to each commit because it's the only way for students to look it and can read an automatic status about tests (comment inside commit)

We won't open CI/CD platform to students

Yes but how to score as tests only have failed/success how to know how many tests there were and how much of them actually failed and how much there is in total

In my case, it's one suitcase:
For examples:

  • Haskell: stack test
    Run 1500 tests across the project
    Process: git clone [email protected]:students/assignmentrepo . and stack test
  • Python: pytest
    Run 250 tests across the project
    Process: git clone [email protected]:students/assignmentrepo . and pytest

The output of each can be redirected to a file or just parsed and we had it to the commit as a comment.

For example if we hide all lines before 829, the end is clear: https://travis-ci.com/github/sycured/streaming_calc_haskell/jobs/298983826#L829

I've no failure in that example but it's very clear

As Gitea is not looking at building a CI itself, we do have a status API, and so this would be perfect for a separate application that reports status back to Gitea.

I take the example all time of using a CI/CD and push back to gitea, I use Zuul and DroneCI at this time so no problem if we can push back status, score and comment on the commit do the ping to CI/CD

Is tests and ci instructions saved in same student repo or it is pulled from somewhere else?

If they are how to prevent student from changing them?

Impossible for student to see it, it's on server side ;)
we load a container image (podman) that students can't access

Ok but ci instructions like .travisci.yml or .drone.yml would still be in students git repo?

Absolutely no because it's server side

I'm just thinking how than travis gets instructions than as they need to be in git repo? :thinking:

Sorry for so many questions, just trying to understand whole process

I won't use Travis CI for this thing… We have a CI/CD like Jenkins/Bamboo where all instructions are saved server-side so no file in repository like CircleCI or Travis CI or DroneCI

It's the same thing about Classroom for GitHub where they ask for a repository including all the tests scripts and process:

Excepted that you're not implementing a CI/CD in gitea, it's better to use our solution

Ok, than we need to think out a way how to use drone ci for this

why not considering it like a webhook and students can't modify/change it ?

Webhook itself is not the problem, problem is that at least Drone CI supports repository instructions to be in repository as file.
btw does students need to submit their task as PR or just as commits?

They commit on their repositories, nothing more.

For Drone and similar, I think, we need like GitHub:

  • 1 repo that is the base repo for student repo
  • 1 repo used by CI/CD to pull tests/process

Workflow:

  1. Instance a docker
  2. git pull [email protected]:organization(or classroom)/repotest-for-assignment1 .
  3. rm -rf .git
  4. git pull [email protected]:stduentid/assignment1 .
  5. Launch test

If you don't want them to edit webhooks you could use global webhooks and connect that to whichever CI system you use, that allows them to have full admin over their repo w/o being able to edit webhooks.

I don't think students need to have admin rights over repo. They should have only write rights, so that they can not mess with automation and integration processes. Anyway for drone ci integration to work only way is to have .drone.yml file in repository IMHO. We could probably implement branch protection to have wilcard filter field to not allow editing files that match that filter.

I don't think students need to have admin rights over repo.

The only way is the possibility for the classroom/organization to create repository for their students inside classroom's/organization's repositories and not anymore inside student's repositories.

What's the best way?
Because the most safe is a repository owned by classroom/organization and adding student as contributor.

IRL: student's code sent for assignment still is owned by student so it's better to have the reposity in student's repositories

Big question for student side: how can we remove full owner rights on the repository inside their account?

We could probably work something out for this like adding field for custom admin user for user repository

Ok, I have implemented protected file patter option in branch protection in PR #10806

Any ETA?

I have started prototype but no eta at the moment

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jorise7 picture jorise7  Â·  3Comments

ghost picture ghost  Â·  3Comments

lunny picture lunny  Â·  3Comments

thehowl picture thehowl  Â·  3Comments

kolargol picture kolargol  Â·  3Comments