#acl Known:write,read,delete,admin,revert All:read ### acl Known:read,write,admin,delete,revert = Gitlab to Canvas syncing = For a working example check out the [[https://gitlab.control.lth.se/regler/FRTF10|FRTF10-repo]] where as soon as anything is pushed to the `master` branch gitlab will automatically upload everything from the `to_canvas` folder to the `from_git` folder found in the [[https://canvas.education.lu.se/courses/1342/files/folder/from_git|course files]] on canvas. == Gitlab CI == Gitlab CI is run through a file called `.gitlab-ci.yml` in the root folder of the repository. This file can setup the environment we need to run certain scripts, define how and what scripts should be run and define in what cases it should be run. An example file can be found [[https://gitlab.control.lth.se/regler/canvassync/-/blob/master/gitlab-ci.yml|here]]. It contains the CANVAS_COURSE_CODE variable which allows the script to figure out which canvas page it should upload to. == Runners == Runners are computers that clone the repo and runs the scripts once something is pushed to `master`. Currently Anders Nilsson has set up his computer as a runner for GitLab, but it should work with other runners also. == Python script == The [[https://gitlab.control.lth.se/regler/canvassync/-/blob/master/canvas_sync.py|python script]] doing the work in the background just scans for a folder called `to_canvas` in the root directory and using the `canvasapi` package it uploads each individual file with corresponding file structure into the `from_git` folder in canvas. Currently the script will only upload files and replace if they already exists, but it wont otherwise delete files if they are removed from gitlab. == Canvas API Token == The API token can be generated in a canvas profile, and this one is generated from an account that should have access to all courses run by Automatic Control. It is available to all repositories in the regler group on gitlab as an environment variable under the name CANVAS_TOKEN.