Salamek / gitlab-tools

Web application providing tools not avaiable in GitLab CE (Gitlab push/pull mirror and more)
GNU General Public License v3.0
99 stars 15 forks source link

Repository names are not correct #36

Closed cenk1cenk2 closed 2 years ago

cenk1cenk2 commented 2 years ago

Hey again @Salamek ,

I just wonder now with the latest additions I have encountered two issues:

The error message is: Error lines received while fetching: error: failed to push some refs to 'gitlab.kilic.dev_1:libraries/cz-cc.git'

My debugging output:

root@bb31e0793154:/home/service/repositories/1/pull/2/7# git pull --mirror
fatal: this operation must be run in a work tree
root@bb31e0793154:/home/service/repositories/1/pull/2/7# cd ..
root@bb31e0793154:/home/service/repositories/1/pull/2# ls
2  7
root@bb31e0793154:/home/service/repositories/1/pull/2# git ^C
root@bb31e0793154:/home/service/repositories/1/pull/2# cd 7
root@bb31e0793154:/home/service/repositories/1/pull/2/7# git remote show origin
ssh: Could not resolve hostname github.com_1: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
root@bb31e0793154:/home/service/repositories/1/pull/2/7# git remote show gitlab
ssh: Could not resolve hostname gitlab.kilic.dev_1: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
root@bb31e0793154:/home/service/repositories/1/pull/2/7#

What can I do to help with these issues?

These do not show inside the frontend task logs as errors but on the stdoutput of the application.

Salamek commented 2 years ago

@cenk1cenk2

One of them is very fatal and it modifies the git URLs with the user id, I am not sure if this was the behavior before, so I am not a hundred percent confident that this is the actual error.

modified hostname in URL is fine, it is used as a "identifier" for sections in '~/.ssh/config' where correct hostname + correct public key is specified... so you have to run those commands as gitlab-tools user for it to work correctly (you are running it as root)

This renaming "hack" was created cos i was unable to pass custom priv key and authorized_hosts to git commands back then (not sure if it is possible now) but this worked fine, and it is documented behavior of ssh client and should not create any issues when run under correct user

The other one is that it does not auto check the form options from the Advanced Options anymore, therefore it changes the options every time the repository is edited unless it is been done manually.

Hmm looks like config is not saved/loaded correctly from DB, i need to check this...

cenk1cenk2 commented 2 years ago

Oh yeah, that is nonsense whenever I run it with a service user now it works fine.

So I guess this one comes from some place else: [worker] W0418 17:23:39.260 4414 remote.py:821] Error lines received while fetching: error: failed to push some refs to 'gitlab.kilic.dev_1:libraries/cz-cc.git'

Salamek commented 2 years ago

Maybe temporary network error? Or some kind of conflict IDK...

cenk1cenk2 commented 2 years ago

Hmm, that would make sense ofc. I will try to debug this further. Thank you very much for your time.

Salamek commented 2 years ago

@cenk1cenk2 That not filled checkbox when editing should be fixed in 1.2.6

cenk1cenk2 commented 2 years ago

Cool, thank you very much and I have done further debugging for the other issue. It seems the network connection between the servers are fine and the SSH request seem to propagate but it is still complaining about not being able to push.

Salamek commented 2 years ago

Hmm try to simulate same commands that gitlab-tools are calling when doing sync, all tasks are in gitlab_tools/tasks/gitlab_tools.py

So depending on in what stage it is crashing for you check the code in corresponding task

cenk1cenk2 commented 2 years ago

Hey @Salamek , I guess this issue was related to having messed up the the db advanced options section, when I selected enable pruning mirrors, all is fine now.

Again I would like to thank you again on writing this very useful tool as well as taking the time maintain it yet again.

Salamek commented 2 years ago

@cenk1cenk2 glad to help :)