Closed tcrowe closed 4 years ago
Oh, and the environment I have is like this.
export BUILDBOT_GITEA_RESOURCE_ENDPOINT=https://your-gitea--host
export BUILDBOT_GITEA_AUTH_URI=https://your-gitea--host/login/oauth/authorize
export BUILDBOT_GITEA_TOKEN_URI=https://your-gitea--host/login/oauth/access_token
buildbot start .
It works :D
Pardon many comments. There is also the master.cfg:
from auth import GiteaAuth
c['www']['auth'] = GiteaAuth('oauth2-client-id', 'oauth2-client-secret')
Hey! This look interesting. But instead of using environment variables you would set those values using a constructor so you can pass it in to the class like this:
from auth import GiteaAuth
c['www']['auth'] = GiteaAuth(
endpoint="https://your-gitea--host",
client_id 'oauth2-client-id',
client_secret='oauth2-client-secret')
AUTH_URI
and TOKEN_URI
should be unnecessary unless they change per gitea installation, otherwise you would just construct them from the endpoint e.g. "{}/login/auth/authorize".format(endpoint)
From the structural side, just create a auth.py
inside the buildbot_gitea
directory, next to reporter.py
. You would also need to add it as an entry point into setup.py
so the buildbot plugin infrastructure picks it up and one can use it using from buildbot.plugins.auth import GiteaAuth
but I can help with that.
Lastly unit tests should be created to test this. The OAuth implementations from GitHub or GitLab into buildbot might be a good reference for this.
Thank you for the guidance. I will give it a try.
Continued in #5
Hi 👋 I'm tapping into your module here and I added this class:
The JSON response seems to be in the exact format it's looking for. https://github.com/buildbot/buildbot/blob/master/master/buildbot/www/oauth2.py
Do you want this in? If so can you guide me to the right path and filename? I am inexperienced in Python modules.
Thank you