This page contains practical recipes for common tasks.
For all students/groups in assignment:
glabs generate <course> <assignment>For selected students/groups using regex patterns:
glabs generate <course> <assignment> alice bob 'a.*'glabs protect <course> <assignment>Use this after changing branch protection settings in config. Does not regenerate repositories, only updates protection rules.
Use this branch config:
branches:
- name: main
mergeOnly: true
default: trueExpected behavior in GitLab UI:
- Allowed to merge: Developers and Maintainers
- Allowed to push and merge: No one
This allows developers to review and merge code, but cannot push directly.
glabs clone <course> <assignment>Useful flags:
-b, --branch: checkout specific branch-p, --path: target directory-f, --force: remove existing directory first-s, --suppress: print only local paths (for scripting)
Examples:
Clone to specific directory:
glabs clone mpd blatt01 -p ~/work/submissionsClone and force-remove existing:
glabs clone mpd blatt01 -f -p /tmp/workClone only students matching pattern:
glabs clone mpd blatt01 'a.*' -p /tmp/workglabs urls <course> <assignment>Open pages directly in browser:
glabs urls <course> <assignment> | xargs openSave to file:
glabs urls <course> <assignment> > urls.txtChange the access level for existing repositories:
glabs setaccess <course> <assignment> -l developerSupported levels:
guest(10): can view projectsreporter(20): can create issues, pull requestsdeveloper(30): can push code, mergemaintainer(40): full admin access
Override per assignment:
glabs setaccess mpd blatt01 -l reporterOnly affect specific students:
glabs setaccess mpd blatt01 alice bob -l maintainerglabs delete <course> <assignment>Delete only specific student repos:
glabs delete mpd blatt01 aliceglabs update <course> <assignment>When to use:
- Early in the semester, before students start working
- To push bug fixes to starter code
- Small template changes across all repos
When NOT to use:
- After students have worked on code
- If you're unsure about merge conflicts
- In production/live semester
Archive (hide from UI):
glabs archive <course> <assignment>Unarchive:
glabs archive <course> <assignment> -uArchived projects are hidden in GitLab UI but:
- Data is still there
- Can be unarchived anytime
- Useful for cleanup at semester end
Default (plain text):
glabs report <course> <assignment>HTML report:
glabs report <course> <assignment> --htmlJSON report (for scripts):
glabs report <course> <assignment> --jsonCustom template:
- Export default template:
glabs report <course> <assignment> -e > template.tmpl-
Modify the template
-
Use custom template:
glabs report <course> <assignment> --html -t template.tmplUse this config for release setup:
release:
mergeRequest:
source: develop # Branch with new code
target: main # Production branch
pipeline: true # Wait for CI/CD to pass
dockerImages:
- myapp/backend
- myapp/frontendWhen configured, glabs can manage:
- Automatic merge request creation
- Docker image builds
- Container registry integration
This enables a GitLab Flow where development happens on develop and production releases are merged to main.
When creating new repositories from startercode, configure issue replication with issues:
issues:
replicateFromStartercode: true
issueNumbers: [1, 3, 7]Behavior:
- Only on newly generated repositories
- Copies title and description from starter repo
- Creates new issues in student repos
- Useful for: assignment requirements, bonus tasks, grading checklist
Examples:
startercode:
url: git@gitlab.example.org:course/starter.git
issues:
replicateFromStartercode: true
issueNumbers: [1] # Replicate first issue (usually assignment spec)For complex seeding (beyond simple startercode copy), use seeder:
seeder:
cmd: python
args:
- /path/to/generator.py
- "%s" # %s is replaced with repo path
name: Generator Bot
email: generator@example.org
toBranch: main
protectToBranch: falseThe seeder script receives the local path and can:
- Generate files programmatically
- Create specific folder structures
- Run build commands
- Commit with custom author/email
With GPG signing:
seeder:
cmd: python
args: [/path/to/gen.py, "%s"]
name: Bot Name
email: bot@example.org
signKey: |
-----BEGIN PGP PRIVATE KEY BLOCK-----
[base64-encoded key]
-----END PGP PRIVATE KEY BLOCK-----When you run generate, you will be prompted for the GPG passphrase if needed.
Debug what glabs actually uses:
glabs show <course> <assignment>This shows the merged configuration after:
- Loading main config (~/.glabs.yaml)
- Loading course config
- Loading assignment config
- Applying defaults
Useful for understanding which values are being used.