Update README.md

This commit is contained in:
Tim Schubert 2018-07-18 12:38:36 +02:00
parent 13232d52c0
commit b297e7cde0
3 changed files with 25 additions and 26 deletions

View file

@ -1,25 +1,24 @@
# The Abgabesystem # The abgabesystem
## Setup ## Setup
0. Configure gitlab with your LDAP configuration. 0. Optional: If you have not previously set up GitLab for the abgabesystem, you can use the playbook in playbook.yml to setup your instance.
1. Generate a deploy key and an API token. 1. Create a new group with the name of the course.
2. Set up container images and runners. 2. Create a fork of abgabesystem inside that group.
- [checkstyle](https://ips1.ibr.cs.tu-bs.de/abgabesystem/checkstyle)
- [abgabesystem](https://ips1.ibr.cs.tu-bs.de/abgabesystem/abgabesystem)
3. Create a group for your course and add all administrative users to it. 3. Configure config.yml and generate an SSH key pair.
Add the private key to the fork as the secret variable SSH_PRIVATE_KEY.
Add the public key to config.yml as deploy_key.
4. Clone [abgabesystem](https://ips1.ibr.cs.tu-bs.de/abgabesystem/docker-abgabesystem) as a private project of that group and add SSH_PRIVATE_KEY and PRIVATE_API_TOKEN to the private variables. 4. Export the student list from StudIP and add it to the project.
5. Edit [config.yml](blob/master/config.yml) to include the name of the student list, your public 5. Create an API key with admin access and add it to the fork as the secret variable PRIVATE_API_TOKEN.
deploy key and the name of the course.
6. Export student list from StudIP and add it to the project. 6. Add all administrative users to the group of your course (but not the students).
7. wait for ci jobs to finish.... The CI jobs should then create the student repositories.
## Recommended settings for gitlab.rb ## Recommended settings for gitlab.rb

View file

@ -16,14 +16,16 @@ class Course(yaml.YAMLObject):
- name: name of the course - name: name of the course
- base: the project containig the official solutions - base: the project containig the official solutions
- students: path to the CSV file that can be exported from Stud.IP - students: path to the CSV file that can be exported from Stud.IP
- deploy_key: a deploy key for deploying student repos to CI jobs
""" """
yaml_tag = 'Course' yaml_tag = 'Course'
def __init__(self, name, base, studentsfile): def __init__(self, name, studentsfile, deploy_key):
self.name = name self.name = name
self.base = base self.base = 'solutions'
self.students = studentsfile self.students = studentsfile
self.deploy_key = deploy_key
def sync_group(self, gl): def sync_group(self, gl):
"""Creates the group for the course """Creates the group for the course
@ -52,7 +54,7 @@ class Course(yaml.YAMLObject):
All student projects will fork from this projects and can be updated using All student projects will fork from this projects and can be updated using
``` ```
git remote add upstream <base-url>.gitlab git remote add upstream <base-url>
git pull upstream master git pull upstream master
``` ```
""" """
@ -117,7 +119,7 @@ class Student():
'name': self.name, 'name': self.name,
'provider': ldap['provider'], 'provider': ldap['provider'],
'skip_confirmation': True, 'skip_confirmation': True,
'extern_uid': 'uid=%s,%s' % (self.user, ldap['basedn']), 'extern_uid': 'uid=%s,%s' % (self.user, ldap['main']['base']),
'password': secrets.token_urlsafe(nbytes=32) 'password': secrets.token_urlsafe(nbytes=32)
}) })
user.customattributes.set('group', self.group) user.customattributes.set('group', self.group)
@ -158,13 +160,11 @@ def sync_project(gl, course, student):
except gitlab.exceptions.GitlabGetError as e: except gitlab.exceptions.GitlabGetError as e:
student_member = project.members.create({'user_id': student.user.id, 'access_level': student_member = project.members.create({'user_id': student.user.id, 'access_level':
gitlab.DEVELOPER_ACCESS}) gitlab.DEVELOPER_ACCESS})
deploy_key = None deploy_key = project.keys.create({
for k in gl.deploykeys.list(): 'title': course.name,
if k.key == course.deploy_key: 'key': course.deploy_key
deploy_key = k })
if deploy_key is None:
print('Missing deploy key. Add global deploy key and sync again')
else:
project.keys.enable(deploy_key.id) project.keys.enable(deploy_key.id)
project.container_registry_enabled = False project.container_registry_enabled = False
project.lfs_enabled = False project.lfs_enabled = False

View file

@ -1,10 +1,10 @@
ldap: ldap:
basedn: "ou=people,dc=tu-bs,dc=de" main:
base: 'ou=people,dc=tu-bs,dc=de'
provider: main provider: main
course: course:
!!python/object:abgabesystem.Course !!python/object:abgabesystem.Course
name: test_course name: test_course
base: test_base
students: Students.csv students: Students.csv
deploy_key: deploy_key:
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKl2zu3ClMIOI6EhEi0qGjwCgEaWYfRl2149T45pcggnYc3CVln0FJhjXvWbfMU984TjJMw4X8dfeZpf9p7xtieAab6yz+vB6QTW1ur9Uge0Wv/D084Sdzb3FovC+Qr90d6BAd+A6+v/vEprTLnuX8McQuB4p8l6iimFrhmv4IdrD1W/y0AUEzdz/eXpsHavlqGrpb4oQ0aAnZq0qQ9cYAltcXKQzgLi7zoKJGNWR+gz4hfRfqme87+k0ABO3hWwcIuwm/XdHm9Z+hjZrPfqmZGJF71FasE9jymP0Si4sgQLjaX+qQh3ojubBN7RwhUo3zjFFFUL5/tLEIr42SGpXF abgabesystem' 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKl2zu3ClMIOI6EhEi0qGjwCgEaWYfRl2149T45pcggnYc3CVln0FJhjXvWbfMU984TjJMw4X8dfeZpf9p7xtieAab6yz+vB6QTW1ur9Uge0Wv/D084Sdzb3FovC+Qr90d6BAd+A6+v/vEprTLnuX8McQuB4p8l6iimFrhmv4IdrD1W/y0AUEzdz/eXpsHavlqGrpb4oQ0aAnZq0qQ9cYAltcXKQzgLi7zoKJGNWR+gz4hfRfqme87+k0ABO3hWwcIuwm/XdHm9Z+hjZrPfqmZGJF71FasE9jymP0Si4sgQLjaX+qQh3ojubBN7RwhUo3zjFFFUL5/tLEIr42SGpXF abgabesystem'