Add tool for fetching all student projects by group
This commit is contained in:
parent
946dbd22e6
commit
3e9d0b119b
2 changed files with 22 additions and 0 deletions
12
tools/build-config.sh
Executable file
12
tools/build-config.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat > python-gitlab.cfg <<EOF
|
||||
[global]
|
||||
default = default
|
||||
ssl_verify = true
|
||||
|
||||
[default]
|
||||
url = $(echo ${CI_PROJECT_URL} | cut -d '/' -f -3)
|
||||
api_version = 4
|
||||
private_token = ${PRIVATE_API_TOKEN}
|
||||
EOF
|
22
tools/groups.py
Executable file
22
tools/groups.py
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/python
|
||||
|
||||
from sys import argv
|
||||
from subprocess import run
|
||||
from os import chdir
|
||||
from os.path import isdir
|
||||
|
||||
course_url = argv[1]
|
||||
|
||||
with open(argv[2], 'r', encoding="latin-1") as csv:
|
||||
for line in csv:
|
||||
tokens = line.split(';')
|
||||
student = tokens[5].replace('"', "").split(" ")[0]
|
||||
group = tokens[0].replace('"', "").split(" ")[0]
|
||||
url = course_url + "/solutions/" + student + "/solutions"
|
||||
path = "solutions/" + group + "/" + student
|
||||
if isdir(path):
|
||||
chdir(path)
|
||||
run(["git", "pull"])
|
||||
chdir("../../..")
|
||||
else:
|
||||
run(["git", "clone", url, path])
|
Loading…
Add table
Add a link
Reference in a new issue