Gitea: Wrong URL when importing from GitLab hosted in subdirectory

Created on 12 Nov 2020  ·  18Comments  ·  Source: go-gitea/gitea

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
kinbug kinmigration

All 18 comments

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

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

https://github.com/go-gitea/gitea/blob/d130cd147f24eb222a539a5b262d166f94aad5fa/modules/migrations/gitlab.go#L44-L46

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 https://github.com/go-gitea/gitea/blob/d130cd147f24eb222a539a5b262d166f94aad5fa/modules/migrations/gitlab.go#L90

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

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

@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)

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

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

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

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.

@pat-s pleace clear the cache

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?

@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?

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

Just joined the discord server.

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

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

@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?

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

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

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'
Was this page helpful?
0 / 5 - 0 ratings