sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.29k forks source link

A gitlab openapi question #59969

Open Wzicheng opened 9 months ago

Wzicheng commented 9 months ago

Question description

I am using sourcegraph version 4.4.2; I encountered an issue with syncing self-hosted GitLab API. I need to sync all repositories under GitLab projects, but if there are more than 100 repositories under projects, syncing fails. Additionally, upon checking the logs, I noticed that it defaults to port 80, but my GitLab is configured with HTTPS. When I manually access the request URL and change the port to 443, I can access it successfully, but it gives an error message "invalid parameter with_shared."

Additional context

error info : fetching from code host GitLab: error listing GitLab projects: url="https://gitlab-self.pc.xetech.com:80/api/v4/groups/XE/projects?id=XE&include_ancestor_groups=false&include_subgroups=false&order_by=created_at&owned=false&page=2&per_page=100&simple=false&sort=desc&starred=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false&with_shared=true": request failed: Get "https://gitlab-self.pc.tech.com:80/api/v4/groups/XE/projects?id=XE&include_ancestor_groups=false&include_subgroups=false&order_by=created_at&owned=false&page=2&per_page=100&simple=false&sort=desc&starred=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false&with_shared=true": http: server gave HTTP response to HTTPS client

When I changed it to "https://gitlab-self.pc.tech.com:80/api/v4/groups/XE/projects?id=XE&include_ancestor_groups=false&include_subgroups=false&order_by=created_at&owned=false&page=2&per_page=100&simple=false&sort=desc&starred=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false&with_shared=true"

error info : {"error":"with_shared is invalid"}

I have tried many methods, including modifying the configuration, but none of them seem to work. It appears that the logic for syncing remote code repositories is hardcoded in the source code. I hope to receive some assistance with this, otherwise I won't be able to access all repositories under the project using Sourcegraph.

Wzicheng commented 8 months ago

Is it a version bug or an issue with other configurations? Has anyone else encountered the same problem?

eseliger commented 8 months ago

Hello @Wzicheng !

Could you share the code host connection configuration with (secrets stripped) here for us to investigate? Thanks!

Also, Sourcegraph 5.3 recently released so there's been a couple of releases in between, maybe upgrading can resolve the issue.

eseliger commented 7 months ago

@Wzicheng any chance you were able to take a look at either a 5.3 upgrade, or getting the redacted code host configuration? :)

Wzicheng commented 7 months ago

Oh, thanks for your response! I've used last_activity_at to solve my issue for now. It still throws an error after surpassing 100 repositories, but it's no longer affecting my usage now.

Wzicheng commented 7 months ago

I had installed the latest version before, but the commercial version requires additional expenses later on. Otherwise, there is a limit of 10 repositories. Currently, we don't have a budget for that, so we haven't encountered this issue. Thanks for having such great software that can benefit more people.

Oh, thanks for your response! I've used last_activity_at to solve my issue for now. It still throws an error after surpassing 100 repositories, but it's no longer affecting my usage now.