-
Notifications
You must be signed in to change notification settings - Fork 15
GitHub integration guide
There are 4 configuration options you need to configure to set up GitHub integration, once you have set up your config directory:
- github_oauth_consumer_key
- github_oauth_consumer_secret
- github_admin_access_token
- github_webhook_secrets
You need to create a new GitHub OAuth application key pair, even if you're just developing ob2 code locally. This is because GitHub requires you to specify a callback URL for your application (for security reasons), and depending on how you run ob2, your callback URL may be different from other people’s.
To set up GitHub OAuth, go to:
- GitHub Settings
- Applications
- Developer Applications (it’s a tab on the top right)
- Register new application
Set your callback URL to http://localhost:5002/log_in/oauth_continue/ or something similar. In production, your callback URL should look like https://cs162.eecs.berkeley.edu/autograder/log_in/oauth_continue/.
Fill in your github_oauth_consumer_key and github_oauth_consumer_secret ob2 configuration options, and you’re done with setting up OAuth! (Make sure you don’t commit your secret keys to version control accidentally, especially to public repos.)
This is not required for local development.
In order to use ob2’s ability to create repositories and add students to them, you’ll need to provide it an API access token for an account that has admin access to your GitHub organization. To create an API key, go to:
- GitHub Settings
- Personal access tokens
These permissions are required:
- repo
- write:repo_hook
- admin:org
These permissions are recommended (you can use an IPython shell to manage your student repos, in which case these permissions will be handy):
- delete_repo
This is not required for local development.
You should configure an organization-wide webhook to send events to the autograder, so the autograder can run when students push their code to GitHub. In order to secure webhooks, you need to configure a webhook secret, which is shared between GitHub and ob2. (You should also make sure to run ob2 with HTTPS, when in production.) To add a webhook, go to:
- GitHub
- Organization Settings
- Webhooks
- Add webhook
Create a random secret token, and put it in the github_webhook_secrets list (note that this is a list, not a string, so you can add multiple secrets).