- Set project visibility to internal.
- Have at least a master branch in solutions repo from which to fork
This commit is contained in:
parent
d7a8440e11
commit
7b8e0461d3
1 changed files with 33 additions and 18 deletions
|
@ -39,7 +39,7 @@ def create_tag(project, tag, ref):
|
|||
deadline
|
||||
"""
|
||||
|
||||
print('Project %s. Creating tag %s' % (project.name, tag))
|
||||
print('Project %s. Creating tag %s' % (project.path, tag))
|
||||
|
||||
project.tags.create({
|
||||
'tag_name': tag,
|
||||
|
@ -150,6 +150,7 @@ def setup_course(gl, group, students_csv, deploy_key):
|
|||
'name': 'solutions',
|
||||
'path': 'solutions',
|
||||
'parent_id': group.id,
|
||||
'visibility': 'internal',
|
||||
})
|
||||
except gitlab.exceptions.GitlabCreateError as e:
|
||||
log.info('Failed to create solutions group. %s' % e.error_message)
|
||||
|
@ -162,7 +163,19 @@ def setup_course(gl, group, students_csv, deploy_key):
|
|||
try:
|
||||
reference_project = gl.projects.create({
|
||||
'name': 'solutions',
|
||||
'namespace_id': solution.id
|
||||
'namespace_id': solution.id,
|
||||
'visibility': 'internal',
|
||||
})
|
||||
reference_project.commits.create({
|
||||
'branch': 'master',
|
||||
'commit_message': 'Initial commit',
|
||||
'actions': [
|
||||
{
|
||||
'action': 'create',
|
||||
'file_path': 'README.md',
|
||||
'content': 'Example solutions go here',
|
||||
},
|
||||
]
|
||||
})
|
||||
except gitlab.exceptions.GitlabCreateError as e:
|
||||
log.info('Failed to setup group structure. %s' % e.error_message)
|
||||
|
@ -198,7 +211,7 @@ def deadline(gl, args):
|
|||
reference = gl.projects.get(args.reference, lazy=True)
|
||||
|
||||
for fork in reference.forks.list():
|
||||
project = gl.projects.get(fork.id, lazy=True)
|
||||
project = gl.projects.get(fork.id, lazy=False)
|
||||
try:
|
||||
create_tag(project, deadline_name, 'master')
|
||||
except gitlab.exceptions.GitlabCreateError as e:
|
||||
|
@ -213,7 +226,6 @@ def plagiates(gl, args):
|
|||
"""
|
||||
|
||||
tag = args.tag_name
|
||||
try:
|
||||
reference = gl.projects.get(args.reference, lazy=True)
|
||||
try:
|
||||
os.mkdir('solutions')
|
||||
|
@ -227,6 +239,8 @@ def plagiates(gl, args):
|
|||
subprocess.run(
|
||||
['git', 'clone', '--branch', tag, project.ssh_url_to_repo, project.path_with_namespace])
|
||||
os.chdir('..')
|
||||
except:
|
||||
print(e.error_message)
|
||||
|
||||
subprocess.run(
|
||||
['java', '-jar', args.jplag_jar, '-s', 'solutions', '-p', 'java', '-r', 'results', '-bc', args.reference, '-l', 'java17'])
|
||||
|
@ -236,7 +250,8 @@ def course(gl, args):
|
|||
try:
|
||||
group = gl.groups.create({
|
||||
'name': args.course,
|
||||
'path': args.course
|
||||
'path': args.course,
|
||||
'visibility': 'internal',
|
||||
})
|
||||
log.info('Created group %s' % args.course)
|
||||
except gitlab.exceptions.GitlabCreateError as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue