-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple forges #138
Comments
There are a few questions which came into mind, that also need to be addressed. To be fair, they slightly address an edge case where one user would like to connect multiple vcs servers (I think that's what they are called in the documentation).
I fear that it introduces complexity on the configuration (env variables). It also introduces config "keys" (e.g. with The alternative would be to store these information in the database and have the admin configure it through the web interface, right? One benefit of that approach I can think of would be to also have the flexibility to customize the given integration. The admin could add a name/title and maybe links to their privacy policy. The admin could also customize the However, I'm not sure what implications this might have, besides being harder to implement. |
I have started to get this feature in by changing the code in small steps #1418 #1417. First of all I will try to load the forges config from the database. The env vars will simply add a signle entry to the database if none with that url exists. To be able to load the forge from the database I will also add a forge-id to each repo. Next step would be to load repositories via their woodpecker internal id and not by their slug. After that we need to check how to use multiple forges at once. For the beginning we could say a user authenticates with a specific forge and that user is by that only seeing repos of a specific forge as well. Later we could check if a user could do some kind of re-authentication with another forge to be able to see repos from multiple forges at once. |
This is the first step towards support for multiple forges (#138). It inserts a forge using the currently existing env varaibles into db and uses this forge from db later on in all places of the code. closes #621 addresses #138 # TODO - [x] add forges table - [x] add id of forge to repo - [x] use forge of repo - [x] add forge from env vars to db if not exists - [x] migrate repo.ForgeID to the newly generated forge - [x] support cache with forge from repo - [x] maybe add forge loading cache? (use LRU cache for forges, I expect users to have less than 10 forges normally) --------- Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Instead of having an account for each forge. What about allowing an account to be connected to multiple forges? Have a table of user_forges type UserForge struct {
ID int64
// References a user
USER_ID int64
FORGE_ID: inti64
// Other OAUTH Token Parameters
} For my purposes in woodpecker this would be easier to manage so I only have user account and don't have to swap accounts to change the pipeline in a different forge. |
That will be absolutely possible in the long term. For the beginning it however will be much easier to have 1user<=>1forge as a lot of api endpoints are not compatible with for example fetching repo details from multiple forges. I almost finished the login part (#3695 & main...anbraten:woodpecker:forge-login) |
Add support for running with GitHub and gitea for example
Idea:
login with $PROVIDER
button and namespace the repositories$PROVIDER/ORG/REPO
$PROVIDER_PROVIDERS
List, egGITEA_PROVIDERS="DEVGITEA,PRODGITEA"
and using these as new variable namesDEVGITEA_OAUTHID=...
TODO
The text was updated successfully, but these errors were encountered: