Set public deploy key

This commit is contained in:
Tim Schubert 2018-05-17 16:39:01 +02:00
parent 06e0dc42de
commit ab5844d859
2 changed files with 10 additions and 1 deletions

View file

@ -147,7 +147,14 @@ def sync_project(gl, course, student):
except gitlab.exceptions.GitlabGetError as e:
student_member = project.members.create({'user_id': student.user.id, 'access_level':
gitlab.DEVELOPER_ACCESS})
project.keys.create({'title': 'abgabesystem', 'key': open('abgabesystem.key.pub').read()})
deploy_key = None
for k in gl.deploykeys.list():
if k.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.container_registry_enabled = False
project.lfs_enabled = False
project.save()

View file

@ -6,3 +6,5 @@ course:
name: test_course
base: test_base
students: Students.csv
deploy_key:
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKl2zu3ClMIOI6EhEi0qGjwCgEaWYfRl2149T45pcggnYc3CVln0FJhjXvWbfMU984TjJMw4X8dfeZpf9p7xtieAab6yz+vB6QTW1ur9Uge0Wv/D084Sdzb3FovC+Qr90d6BAd+A6+v/vEprTLnuX8McQuB4p8l6iimFrhmv4IdrD1W/y0AUEzdz/eXpsHavlqGrpb4oQ0aAnZq0qQ9cYAltcXKQzgLi7zoKJGNWR+gz4hfRfqme87+k0ABO3hWwcIuwm/XdHm9Z+hjZrPfqmZGJF71FasE9jymP0Si4sgQLjaX+qQh3ojubBN7RwhUo3zjFFFUL5/tLEIr42SGpXF abgabesystem'