Skip to content
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

How to Gitea integration? #375

Open
zamachuga opened this issue Jul 7, 2021 · 12 comments
Open

How to Gitea integration? #375

zamachuga opened this issue Jul 7, 2021 · 12 comments

Comments

@zamachuga
Copy link

https://gitea.io/en-us/
How to Gitea integration?

@lds-lds
Copy link

lds-lds commented Nov 18, 2021

Hello
I also use gitea, and it would be great for us if you implemented source integration for gitea

@dregad
Copy link
Member

dregad commented Nov 18, 2021

Contributions are always welcome, feel free to submit a pull request for gitea integration.

@fokkersim
Copy link

I currently work on it based on the GitHub Plugin. Its not finished yet but basically working. Code cleanup is needed. Still have some questions and a few unclear points. I hope I can create a repository for it soon. I still need to implement the webhook creation through button clich from the repo configuraton page.

@dregad
Copy link
Member

dregad commented Feb 14, 2022

I currently work on it based on the GitHub Plugin

Great news, thanks ! Looking forward to it.

Still have some questions and a few unclear points

Can't help with the Gitea side of things, but if your questions are related to MantisBT or the Source Integration framework, I'll be glad to assist if I can. Just ask !

I hope I can create a repository for it soon

Rather than having it as a standalone repository, I would suggest to bundle your plugin with this one, whenever you're ready.

@lds-lds
Copy link

lds-lds commented Feb 15, 2022

I currently work on it based on the GitHub Plugin.
Oh great :) thanks @fokkersim

@fokkersim
Copy link

fokkersim commented Feb 15, 2022

Can't help with the Gitea side of things, but if your questions are related to MantisBT or the Source Integration framework, I'll be glad to assist if I can. Just ask !

Oh great! On which channel should I contact you? Basically first big question is: Is it normal that the Mantis repository $t_repo->id changes when a "Import Everything" is done? If yes, how to handle this with respect to oauth refresh token usage? The redirect_uri seems to need the repository id as a parameter for the Reply with the code. When the repo id changes the token refresh via oauth fails due to a now wrong redirect_uri.

@dregad
Copy link
Member

dregad commented Feb 15, 2022

On which channel should I contact you

Here is fine, or if you prefer https://gitter.im/mantisbt-plugins/source-integration (if I'm on-line you may get faster turnaround)

Is it normal that the Mantis repository $t_repo->id changes when a "Import Everything" is done?

That's just the way the plugin was originally written (long before I took over the project's maintenance). Not sure I would call that normal, though. I agree that changing repo id is confusing at best, and may cause issues.

AFAIK, the idea was to perform the full import into a new, empty repository so the original could be kept and restored in case of errors during the import operation, but I do not think there was any actual intention to change the id; that's probably just a side effect.

how to handle this with respect to oauth refresh token usage? The redirect_uri seems to need the repository id as a parameter for the Reply with the code. When the repo id changes the token refresh via oauth fails due to a now wrong redirect_uri.

I was not aware of any issues with changing repo id until now, but TBH the full import is a feature I rarely use.

@fokkersim
Copy link

fokkersim commented Feb 16, 2022

Making a full import like that makes totally sense to me, but keeping the id would be probably nice?

I was not aware of any issues with changing repo id until now, but TBH the full import is a feature I rarely use.

I think this/my question can be seen best in oauth_authorize.php where the id and the code is required as a parameter to process the further authentication procedure after the initial request. This involves then later on to assign also the authentication token and refresh token to a repository. At the moment I dont see, how this would work with one authentication for all repositories configured in Mantis. Probably something like iterating through all repositories and checking for the application id and populate all repos with the same application id with the same authentication token and refresh token once the oauth procedure is finished? Am I missing smth. here? Basically its not a problem to do the oauth procedure for every repo, it works.

@dregad
Copy link
Member

dregad commented Feb 17, 2022

assign also the authentication token and refresh token to a repository [...]
I dont see, how this would work with one authentication for all repositories configured in Mantis

I believe this is by design, it was never meant to be a global authentication

@fokkersim
Copy link

fokkersim commented Feb 18, 2022

I believe this is by design, it was never meant to be a global authentication

I never would have had the idea that this could work, if it wouldnt be mentioned in the Github plugin documentation

NOTE: a single OAuth app is sufficient to handle all the GitHub repositories configured in a given MantisBT instance Github doc

@fokkersim
Copy link

fokkersim commented Feb 18, 2022

I found out that this works for github, because github allows redirect_uris to be more felxible than gitea (see last two sentences). So that means for github your could define in github settings redirect_uri = https://mydomain/mantisbt/ and at the same time pass https://mydomain/mantisbt/+SUBDIRECTORY+PARAMS in the authentication request, which makes no issues. This is why a single OAuth app is sufficient for all github repos...

@fokkersim
Copy link

I could not work on this for a couple of weeks now. I made a push to my repository https://github.com/fokkersim/SourceGitea
maybe it helps. Basics seem to work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants