Skip to content

Issue starting sourcebot using selfhosted gitlab config #55

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
iFloris opened this issue Oct 29, 2024 · 4 comments
Closed

Issue starting sourcebot using selfhosted gitlab config #55

iFloris opened this issue Oct 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@iFloris
Copy link

iFloris commented Oct 29, 2024

Hello, I'm having trouble getting the latest tag running using a selfhosted gitlab config.

My config looks like this, based on the selfhosted example:

{
  "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v2/index.json",
  "repos": [
    // GitLab instance
    {
      "type": "gitlab",
      "url": "https://gitlab.my-url.com",
      "token": "my-group-token-with-read-permissions",
      "groups": [
        "my-group" // my global group
      ]
    }
  ]
}

However, I get the following error:

docker run -p 3000:3000 --rm --name sourcebot \
  -v ~/Downloads/my_config.json:/data/my_config.json \
  -e CONFIG_PATH=/data/my_config.json \
  ghcr.io/sourcebot-dev/sourcebot:latest
[Info] Sourcebot version: v2.1.1
[Info] Using config file at: '/data/my_config.json'.
2024-10-29 11:14:27,179 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-10-29 11:14:27,189 INFO supervisord started with pid 7
2024-10-29 11:14:28,200 INFO spawned: 'backend' with pid 135
2024-10-29 11:14:28,213 INFO spawned: 'web' with pid 136
2024-10-29 11:14:28,251 INFO spawned: 'zoekt' with pid 137
2024-10-29 11:14:29,902 INFO success: backend entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-10-29 11:14:29,904 INFO success: web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-10-29 11:14:29,907 INFO success: zoekt entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[web] |   ▲ Next.js 14.2.10
[web] |   - Local:        http://localhost:3000
[web] |   - Network:      http://0.0.0.0:3000
[web] |
[web] |  ✓ Starting...
[backend] | 2024-10-29T11:14:30.608Z info: [main] Syncing configuration file /data/my_config.json ...
[web] |  ✓ Ready in 951ms
[backend] | 2024-10-29T11:14:32.652Z error: [main] Failed to sync configuration file /data/my_config.json with error:
[backend] | TypeError: Cannot read properties of undefined (reading 'toString')
[backend] |     at file:///app/packages/backend/dist/gitlab.js:72:59
[backend] |     at Array.map (<anonymous>)
[backend] |     at getGitLabReposFromConfig (file:///app/packages/backend/dist/gitlab.js:49:10)
[backend] |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[backend] |     at async syncConfig (file:///app/packages/backend/dist/index.js:63:37)
[backend] |     at async measure (file:///app/packages/backend/dist/utils.js:3:18)

What am I doing wrong?

Thanks in advance for any and all suggestions :)

@brendan-kellam
Copy link
Contributor

Thanks for raising the issue! It looks like things are breaking on this line when we read the forks_count property - it looks like this property is not included in your response body for some reason?

Could you confirm if forks_count is included when running curl --header "PRIVATE-TOKEN: <your-token>" https://gitlab.my-url.com/api/v4/groups/<group-name>/projects ?

Could you also check the api version of your instance? curl --header "PRIVATE-TOKEN: <your-token>" https://gitlab.my-url.com/api/v4/version

@brendan-kellam brendan-kellam added the bug Something isn't working label Oct 29, 2024
@iFloris
Copy link
Author

iFloris commented Oct 30, 2024

Hello, thanks for gettin back to me @brendan-kellam!

Here is the info you requested:

curl --header "PRIVATE-TOKEN: my-token" "https://gitlab.my-gitlab.com/api/v4/groups/my-group/projects" | gron | fgrep "fork"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 62072  100 62072    0     0   137k      0 --:--:-- --:--:-- --:--:--  138k
json[0].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[0].forking_access_level = "enabled";
json[0].forks_count = 0;
json[1].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[1].forking_access_level = "enabled";
json[1].forks_count = 0;
json[2].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[2].forking_access_level = "enabled";
json[2].forks_count = 1;
json[3].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[3].forking_access_level = "enabled";
json[3].forks_count = 0;
json[4].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[4].forking_access_level = "enabled";
json[4].forks_count = 0;
json[5].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[5].forking_access_level = "enabled";
json[5].forks_count = 0;
json[6].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[6].forking_access_level = "enabled";
json[6].forks_count = 0;
json[7].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[7].forking_access_level = "enabled";
json[7].forks_count = 0;
json[8].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[8].forking_access_level = "enabled";
json[8].forks_count = 0;
json[9].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[9].forking_access_level = "enabled";
json[9].forks_count = 0;
json[10].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[10].forking_access_level = "enabled";
json[10].forks_count = 0;
json[11].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[11].forking_access_level = "enabled";
json[11].forks_count = 0;
json[12].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[12].forking_access_level = "enabled";
json[12].forks_count = 0;
json[13].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[13].forking_access_level = "enabled";
json[13].forks_count = 0;
json[14].ci_allow_fork_pipelines_to_run_in_parent_project = true;
json[14].forking_access_level = "enabled";

So it seems forks_count is included.

The version (a bit older):

{"version":"16.1.2-ee","revision":"0642e8c5c91","kas":{"enabled":true,"externalUrl":"wss://gitlab.my-gitlab.com/-/kubernetes-agent/","version":"v16.1.3"},"enterprise":true}%                                                       

@brendan-kellam
Copy link
Contributor

I added null checks to the properties star_count and forks_count in 934bc8d. When you get a chance, could you try out the latest release and see if the issue is resolved?

@iFloris
Copy link
Author

iFloris commented Oct 30, 2024

Thanks! This seems to have fixed my issue. 😃

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

No branches or pull requests

2 participants