Skip to content

How to sync selected repositories / groups on Gitlab #36

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

Closed
illagrenan opened this issue Oct 9, 2024 · 3 comments · Fixed by #37
Closed

How to sync selected repositories / groups on Gitlab #36

illagrenan opened this issue Oct 9, 2024 · 3 comments · Fixed by #37
Labels
bug Something isn't working

Comments

@illagrenan
Copy link

Thanks for a great project. I'm trying to sync git repositories with self-hosted Gitlab and would like to sync only repositories from a specific group:

https://gitlab.example.com/my-group/my-project/

This is my configuration:

{
  "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/index.json",
  "configs": [
    {
      "type": "gitlab",
      "gitlabURL": "https://gitlab.example.com",
      "Name": "^(my-group/.*|my-other-group/.*)$"
    }
  ]
}

In the log, I see that zoekt-mirror-gitlab is getting the configuration like this:

run [zoekt-mirror-gitlab -dest /data/.sourcebot/repos -url https://gitlab.example.com -name ^(my-group/.*|my-other-group/.*)$]

And yet, no repositories are synchronized. I'd say I have the regex wrong, but I haven't found any additional info on this.

Thanks in advance for the help!

@brendan-kellam brendan-kellam added the bug Something isn't working label Oct 9, 2024
@brendan-kellam
Copy link
Contributor

Hey thanks for the issue! I looked into this and it's a pretty subtle bug. When performing the filtering in zoekt-mirror-gitlab, zoekt is using the name_with_namespace field of the project to filter on. Looking at the GitLab docs reveals that name_with_namespace has spaces between group, /, and the repository:

image

The regex is therefore not matching. I validated that using ^(my-group /.*|my-other-group /.*)$ (notice the space) worked.

What we really want to use is path_with_namespace so we don't have to deal with this. Will make a fix now.

@brendan-kellam
Copy link
Contributor

Just released v1.0.2 with the fix - let me know if it fixed it for you!

@illagrenan
Copy link
Author

Thank you so much for such a quick fix. Everything seems to be working as it should. gj!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants