GabrielDougherty / edinboro-gitlab-assignment

Edinboro University Assignment Submission System. A fork of UWaterloo's gitlab-assignment at https://git.uwaterloo.ca/cscf/gitlab-assignments
0 stars 1 forks source link

Quickstart

This is a quickstart guide for faculty on using the Edinboro Assignment Submission System

Prerequisites

You must have git, python >= 3.4, and pip3 installed. This guide assumes a Linux machine is used. In order to create students, you must be an administrator on the codestore instance. Talk to your system administrator for these priveleges if you are an instructor and you plan on creating users.

Installation

In the directory that you would like your script to be installed, type:

$ git clone https://github.com/GabrielDougherty/edinboro-gitlab-assignment.git
$ cd edinboro-gitlab-assignment

To install the python-gitlab module, in the project directory, type:

$ pip3 install --user -r requirements.txt

This will install the module for the current user.

Now, you can run any script by typing, python3 scriptname.py

Getting Help

To see descriptions of the available arguments for a command, call the command with the --help flag.

For example, typing python3 create-class.py --help provides the argument descriptions for the create-class script.

Getting Authenticated

In order to use these scripts, you must creat an authentication token.

In your installation directory edinboro-gitlab-assignment, create a text document called test_token:

$ touch test_token

Then go to the codestore and log in. If you are faculty and you don't already have an account, you should create an account at this step. If you're a student, then the codestore admnistrator should create a login for you.

Once you are logged in, click on the profile icon in the top right, then click on Settings in the drop-down. In the resulting page, click on Access Tokens. In this page, you must create an access token to be used for all of your classes you would like to manage. Give it a name like MyToken, and check the "api" box. Then click "Create personal access token."

In the resulting page, copy the text string under "Your New Personal Access Token" and paste it into your test_token using the text editor of your choice. Save that document, and you will be properly authenticated for using all of the scripts.

Creating User Accounts

The first step to take in order to use scripts such as create-class.py, and create-group-projects.py, is to create any necessary user accounts. All of the students in your class must have a Gitlab account in order to participate in this system. This script gives the instructor (you) the ability to automatically create user accounts for all of the students in a certain course and section. If a student already has a user account, they will be skipped.

For this script to function, a roster .CSV file must be included in the same directory that this script is included in. The roster file should follow a format that matches the following:

CSCI,408,1,SOFTWARE ENGINEERING,@00803819,Bob,Jim,5-Oct-97,jb123456@scots.edinboro.edu  
CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Jackson,Bo,5-Oct-97,bj123456@scots.edinboro.edu  
CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Woods,Tiger,5-Oct-97,tw123456@scots.edinboro.edu 

Having multiple course and section numbers in the same file is fine, as the script will only create users that have a matching course and section number to what is defined by the professor (you). User accounts will be created using the following criteria:

So, looking at a user with the following information:

CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Bob,Jim,5-Oct-97,jb123456@scots.edinboro.edu

We would get a user account with the following attributes:

To use this script, and add all of the students in the roster file that are members of CSCI408-1 from the csci408.CSV roster file, type:

​$ python3 create-users.py --file-name csci408.CSV --course-number 408 --course-section 1​

If the wrong file name is entered, or there are no students that belong to that course and section number, an error will be displayed and you will have to try again.

Creating a class

In GitLab, a class (i.e., CSCI408), is a GitLab Group. This is simply a collection of repositories on the server.

Our script for creating such a group assumes that the course will be identified by a course name and sections number. Hence, the instructor (you) must only provide the course name (i.e., CSCI408), its section number (i.e., 1), and the semester (Fall or Spring) to create a class.

In order to create the above class, section 1 of CSCI408, called csci-408-1, type:

​$ python3 create-class.py --course-name "CSCI408" --semester "Spring" --course-section "1"​

This script can also use a roster .CSV file to automatically add user accounts to the Gitlab group being created. This file must be included in the same directory as this script is included in. In order to create the above class, and add students from a roster file, type:

​$ python3 create-class.py --course-name "CSCI408" --course-section "1" --semester "Spring" --file-name "csci408.csv"​

The .CSV file should follow a format that matches the following:

CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Bob,Jim,5-Oct-97,jb123456@scots.edinboro.edu  
CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Jackson,Bo,5-Oct-97,bj123456@scots.edinboro.edu  
CSCI,408,1,SOFTWARE ENGINEERING,@00230405,Woods,Tiger,5-Oct-97,tw123456@scots.edinboro.edu

If multiple classes/sections of a class are included in the classlist file, then only the students from the specified class and section number will be added from the file.

Creating Group Projects Within A Class

Once you have created a Gitlab group for a certain class, you can then create group projects within the class. These group projects allow students to all be in a repository together, allowing them to all make changes to the files within the repository.

Our script for creating group projects assumes that all of the users you wish to add to the groups have Gitlab accounts, and the class you wish to create the groups in has already been created as well. It also assumes you have created a .CSV file with the following format:

sm646464,pp646464
lj232323,ai123456
fb123456,tl123456

Each line represents each group. The group members should be identified using their Gitlab usernames and should be separated by a comma. This file would create 3 different groups with the two members each.

To run the script to create a project called LinkedListProject in the Gitlab group csci-408-1, using the file groups.CSV type:

​$ python3 create-group-project.py --group-name csci-408-1 --project-name LinkedListProject --file-name groups.csv​

If there are multiple groups, each will be followed by a number value to differentiate between them. For the above example, you would get 3 different group repositories named LinkedListProject 1, LinkedListProject 2, and LinkedListProject 3.