repo-updater crash with gitlab with projects with both id and name
Created by: perrinjerome
- Sourcegraph version: 3.19.2
- Platform information:
Latest release installed locally with:
docker run --publish 7080:7080 --publish 127.0.0.1:3370:3370 --rm --volume ~/.sourcegraph/config:/etc/sourcegraph --volume ~/.sourcegraph/data:/var/opt/sourcegraph sourcegraph/server:3.19.2
Steps to reproduce:
- add a repository Manage repositories -> Gitlab Self-Managed
2.enter a json with an entry in
projects
with bothname
andid
, for example:
{
"url": "https://gitlab.com",
"token": "X",
"projectQuery": [
"none"
],
"projects": [
{
"name": "perrinjerome/music",
"id": 1969957
}
]
}
Expected behavior:
Probably this should not validate the json schema and saving should not be allowed, at least this should not crash repo-updater
component.
Actual behavior:
repo-updater
crash:
00:59:35 repo-updater | panic: invalid args (specify exactly one of id and pathWithNamespace)
00:59:35 repo-updater | goroutine 862 [running]:
00:59:35 repo-updater | github.com/sourcegraph/sourcegraph/internal/extsvc/gitlab.(*Client).GetProject(0xc0015cc7e0, 0x1b37260, 0xc0013ad240, 0x1e0f25, 0xc0004a07e0, 0x12, 0xc0013d3c01, 0x1, 0xc001107f78, 0x6f17c0)
00:59:35 repo-updater | github.com/sourcegraph/sourcegraph/internal/extsvc/gitlab/projects.go:66 +0x296
00:59:35 repo-updater | github.com/sourcegraph/sourcegraph/cmd/repo-updater/repos.(*GitLabSource).listAllProjects.func1(0xc00047b0e0, 0xc0010dcd20, 0xc0013ad480, 0x1b37260, 0xc0013ad240, 0xc0010dccc0)
00:59:35 repo-updater | github.com/sourcegraph/sourcegraph/cmd/repo-updater/repos/gitlab.go:184 +0x102
00:59:35 repo-updater | created by github.com/sourcegraph/sourcegraph/cmd/repo-updater/repos.(*GitLabSource).listAllProjects
00:59:35 repo-updater | github.com/sourcegraph/sourcegraph/cmd/repo-updater/repos/gitlab.go:181 +0x127
00:59:35 repo-updater | Terminating repo-updater