Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CSCE 361
scripts
Commits
aaa69d09
Commit
aaa69d09
authored
Oct 14, 2019
by
Christopher Bohn
Browse files
Options
Downloads
Patches
Plain Diff
Provides more information while creating repos
parent
72b234f1
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
api/composite_user.py
+3
-2
3 additions, 2 deletions
api/composite_user.py
prep_assignment.py
+11
-3
11 additions, 3 deletions
prep_assignment.py
with
16 additions
and
7 deletions
README.md
+
2
−
2
View file @
aaa69d09
...
...
@@ -29,7 +29,7 @@ of repositories for student assignments.
-
prep_assignment.py
-
An early iteration of automated student pairing, canvas student group creation, and gitlab repo creation. It
lacks robustness to odd number of students; it has a quick'n'dirty loop termination that does not guarantee
graylist compliance, and project naming is hard-coded.
graylist compliance, and project naming is hard-coded.
Also does not tolerate non-existent usernames.
-
api/
-
canvas_classes.py
...
...
This diff is collapsed.
Click to expand it.
api/composite_user.py
+
3
−
2
View file @
aaa69d09
...
...
@@ -61,9 +61,10 @@ class CompositeUser:
def
__repr__
(
self
):
if
self
.
canvas_email
==
self
.
gitlab_email
:
return
f
'
{
self
.
readable_name
}
<
{
self
.
canvas_email
}
>
'
return
f
'
{
self
.
readable_name
}
, gitlab @
{
self
.
gitlab_username
}
, email
<
{
self
.
canvas_email
}
>
'
else
:
return
f
'
{
self
.
readable_name
}
<
{
self
.
canvas_email
}
> <
{
self
.
gitlab_email
}
>
'
return
f
'
{
self
.
readable_name
}
, gitlab @
{
self
.
gitlab_username
}
,
'
\
f
'
email <
{
self
.
canvas_email
}
> <
{
self
.
gitlab_email
}
>
'
def
__eq__
(
self
,
other
):
if
isinstance
(
other
,
CompositeUser
):
...
...
This diff is collapsed.
Click to expand it.
prep_assignment.py
+
11
−
3
View file @
aaa69d09
...
...
@@ -48,15 +48,23 @@ def save_pairs(assignment_number, student_pairs):
pair_file
.
write
(
f
'
-
{
pair
[
2
]
}
\n
'
)
def
create_repositories
(
assignment_number
,
student_pairs
):
def
create_repositories
(
assignment_number
,
student_pairs
,
verbose
):
if
verbose
:
print
(
'
Creating file for clone script.
'
)
filename
=
f
'
{
assignment_number
}
-clone.sh
'
with
open
(
filename
,
mode
=
'
w
'
)
as
clone_file
:
clone_file
.
write
(
'
#!/bin/bash
\n\n
'
)
clone_file
.
write
(
'
# Auto-generated clone script.
\n
'
)
for
pair
in
student_pairs
:
if
verbose
:
print
(
f
'
Creating repo for pair number
{
pair
[
0
]
}
'
)
project
=
GitlabProject
.
create_project_in_group
(
Course
.
gitlab_namespace
,
f
'
{
assignment_number
}
pair
{
pair
[
0
]
}
'
)
if
verbose
:
print
(
f
'
\t
Adding
{
pair
[
1
]
}
'
)
project
.
add_user_as_maintainer
(
pair
[
1
].
get_gitlab_user
())
if
verbose
:
print
(
f
'
\t
Adding
{
pair
[
2
]
}
'
)
project
.
add_user_as_maintainer
(
pair
[
2
].
get_gitlab_user
())
repo_url
=
project
.
get_cloning_url
()
clone_file
.
write
(
f
'
git clone
{
repo_url
}
\n
'
)
...
...
@@ -73,12 +81,12 @@ def create_groups(assignment_number, student_pairs):
if
__name__
==
'
__main__
'
:
assignment
=
21
assignment
=
'
21
b
'
pairs
=
create_pairs
(
'
2019-08.csv
'
)
save_pairs
(
assignment
,
pairs
)
print
(
'
Pairs created
'
)
create_repositories
(
assignment
,
pairs
)
create_repositories
(
assignment
,
pairs
,
True
)
print
(
'
Repositories created
'
)
create_groups
(
assignment
,
pairs
)
print
(
'
Canvas groups created
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment