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

Wrong URL when importing from GitLab hosted in subdirectory #13535

Closed
pat-s opened this issue Nov 12, 2020 · 18 comments · Fixed by #13563 or #13629
Closed

Wrong URL when importing from GitLab hosted in subdirectory #13535

pat-s opened this issue Nov 12, 2020 · 18 comments · Fixed by #13563 or #13629
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug

Comments

@pat-s
Copy link
Member

pat-s commented Nov 12, 2020

Gitea v1.13.0-rc2

Note that in the GET request gitlab/ is missing after the domain name.

(not sure if the error message is related to this though)

Migrating from http://my.gitlab.domain/gitlab/user/test.git failed.

GET https://my.gitlab.domain/api/v4/projects/gitlab/user/test: 502 failed to parse unknown error format
@lunny lunny added the type/bug label Nov 13, 2020
@lafriks
Copy link
Member

lafriks commented Nov 14, 2020

How does url for subgroup repository does look like in such case?

@6543 6543 added the topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them label Nov 14, 2020
@6543
Copy link
Member

6543 commented Nov 14, 2020

since gitlab has namespaces, the migration tool cant difference by url if it is a subdirectory or namespace ...

baseURL := u.Scheme + "://" + u.Host
repoNameSpace := strings.TrimPrefix(u.Path, "/")
repoNameSpace = strings.TrimSuffix(repoNameSpace, ".git")

so we either have to walk throu the path and test if it works ... or add a subdirectory option ...

idear:

if len(strings.split(path,"/")) > 2,
    then test if you can get gitlab-version ...
        if not add first part of path to baseUrl,
        repeat until repoPath == 2,
            if it still fails -> error no gitlab detected 

this should go before

// Grab and store project/repo ID here, due to issues using the URL escaped path

@6543 6543 added good first issue Likely to be an easy fix and removed good first issue Likely to be an easy fix labels Nov 14, 2020
@6543
Copy link
Member

6543 commented Nov 14, 2020

@pat-s are you able to test #13563 ?

@pat-s
Copy link
Member Author

pat-s commented Nov 14, 2020

If there is a docker image being created for this branch yes, otherwise no. I can test once its merged into master.

@6543
Copy link
Member

6543 commented Nov 14, 2020

@pat-s are you allowed to send me temporary read access token & url to my email so I can test?

Mail: “6543[a-t]obermui.de” PGP Key (A1CA74D27FD13271)

@pat-s
Copy link
Member Author

pat-s commented Nov 14, 2020

This won't work, neither time nor permission wise I guess.

Happy to test once its in master then. Thanks for your work!

@6543
Copy link
Member

6543 commented Nov 16, 2020

@pat-s It's in master - would be nice if you can verify it :)

@pat-s
Copy link
Member Author

pat-s commented Nov 18, 2020

Pulled the latest master (Gitea Version: 1.14.0+dev-233-g0615b668d) and now I get

Invalid csrf token.

when hitting the migrate button.

I double-checked that the token is valid.

No errors in the logs.

@6543
Copy link
Member

6543 commented Nov 18, 2020

@pat-s pleace clear the cache

@pat-s
Copy link
Member Author

pat-s commented Nov 18, 2020

Helped. Still getting the same error as described though.

Could it be an issue with our nginx config and some rewrite rules that might not work as expected with respect to GitLabs API endpoint?

@6543
Copy link
Member

6543 commented Nov 18, 2020

@pat-s are you on discord - so we dont spam others email box too mouch?

Does it still show "invalid csrf token" or another error?

@pat-s
Copy link
Member Author

pat-s commented Nov 18, 2020

Whom are we spamming? AFAICS all of this contributes to this issue.

Just joined the discord server.

@6543 6543 reopened this Nov 18, 2020
@6543
Copy link
Member

6543 commented Nov 18, 2020

tested with: https://play.golang.org/p/NnK3Xhabn2s that this issue is still here :/

6543 added a commit to 6543-forks/gitea that referenced this issue Nov 19, 2020
techknowlogick pushed a commit that referenced this issue Nov 19, 2020
techknowlogick pushed a commit to techknowlogick/gitea that referenced this issue Nov 19, 2020
@pat-s
Copy link
Member Author

pat-s commented Nov 19, 2020

With 1.14.0+dev-239-gad2a28862 as of this morning I am still facing the issue :/

@6543
Copy link
Member

6543 commented Nov 19, 2020

@pat-s this time I tested it sucessfully with https://gitlab.pr.gitea.io/gitlab/awesomegroup/supgr1/subsubgr/totalchaos.git

but can you test https://play.golang.org/p/mvuSegdaSm5 localy with your own repo and tell me the outcome?

@pat-s
Copy link
Member Author

pat-s commented Nov 19, 2020

GL returned:
error: '<nil>'
version: '<nil>'
new base: 'http://DOMAIN/gitlab'
new repoPath: 'patrick/cynkra-test'
this error should not happen(2):
Get "http://DOMAIN/api/v4/version": dial tcp: lookup DOMAIN on 169.254.169.254:53: dial udp 169.254.169.254:53: connect: no route to host

tested in the go playground

Running locally I get

GL returned:
error: '<nil>'
version: '<nil>'
new base: 'http://DOMAIN/gitlab'
new repoPath: 'patrick/cynkra-test'
this error should not happen(2):
GET https://DOMAIN/api/v4/version: 502 failed to parse unknown error format

techknowlogick added a commit that referenced this issue Nov 19, 2020
* finaly fix #13535

* add logging

Co-authored-by: 6543 <6543@obermui.de>
@6543
Copy link
Member

6543 commented Nov 19, 2020

@pat-s https://play.golang.org/p/QKFBmIZxZpC ... we get there ...

@pat-s
Copy link
Member Author

pat-s commented Nov 19, 2020

GL returned:
error: '<nil>'
version: '<nil>'
new base: 'http://DOMAIN/gitlab'
new repoPath: 'patrick/cynkra-test'
GL returned:
error: 'GET https://DOMAIN/api/v4/version: 502 failed to parse unknown error format'
version: 'gitlab.Version{Version:"13.5.3-ee", Revision:"b9d194b6b91"}'break
SUCESS!

BaseURL: 'http://DOMAIN/gitlab'
RepoPath: 'patrick/cynkra-test'

@go-gitea go-gitea locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
4 participants