getsentry / getsentry/sentry

GitLab Integration: malformed repository urls

Open Beginner friendly
#112,454 4 comments 1 reaction 0 assignees View on GitHub
Bug GitLab Product Area: Settings - Integrations
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 10m
Merged PRs (30d)
635

Description

### Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

### Steps to Reproduce

Wanted to integrate my **self-hosted sentry** instance with my **self-hosted GitLab** instance and it almost worked.
Integration is shown as "Installed" in green, but repository urls looks malformed.

Example:
https://gitlab.domain.com/homenet%20/%20connect

Steps:

1- Create a service account user in GitLab svc-sentry
2- Set svc-sentry user as Maintainer or Owner for the Group homenet (this is a group that have projects and subgroups with projects)
3- Created the OAuth Application at the group level
4- Installed the integration following the instructions
- Left GitLab Group Path empty
- Include Subgroups checkbox not checked

After this, the integration is installed successfully.

Image

But when i got to repositories and try to add one, i always get a 422 Invalid Url. This is because the url is malformed.

Image

The problem is raised probably in this code:

https://github.com/getsentry/sentry/blob/3e94bc19b46015b3b87e7b85a34e0351aa03c473/src/sentry/integrations/gitlab/integration.py#L167

should be `path_with_namespace` instead of `name_with_namespace` i guess.

### Expected Result

I should be able to add a repository and not receive a 422 Invalid Url error anymore.

### Actual Result

Clicking add a repository from the llist, i get a 422 Invalid Url error.

### Product Area

Settings - Repositories

### Link

_No response_

### DSN

_No response_

### Version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at src/sentry/integrations/gitlab/integration.py around line 167, where the repository URL is assembled, and compare the GitLab fields used there with the reported malformed URL. Reproduce adding a repository from a self-hosted GitLab integration; done means the repository URL is valid and adding it no longer returns a 422 Invalid Url error.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, python
Domain
backend, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.