Skip to content
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

GitlabOcean backend doesn't cater for subgroups #946

Open
StingRayZA opened this issue Oct 20, 2020 · 0 comments
Open

GitlabOcean backend doesn't cater for subgroups #946

StingRayZA opened this issue Oct 20, 2020 · 0 comments
Labels

Comments

@StingRayZA
Copy link

Hi

(apologies if this should rather be logged at https://github.com/chaoss/grimoirelab-perceval)

I have a gitlab site URL that looks something like this:

https://my.gitlab.instance.internal.com/groupname/subgroupname/projectname

When the GitlabOcean gets initialised and get_perceval_params_from_url is called, the 'groupname' from the URL gets lost. As a result, all the future interactions that try to 'rebuild' the URL and/or the API URL get a 404 error as they build the following URLs, which don't exist:

https://my.gitlab.instance.internal.com/subgroupname/projectname or https://my.gitlab.instance.internal.com/api/v4/projects/subgroupname%2Fprojectname

I've hacked in a fix by replacing this line in grimoire_elk/raw/gitlab.py:

        owner = repo.split('/')[-2]

with this:

        fields = len(repo.split('/'))
        if fields == 5:
            owner = repo.split('/')[-2]
        else:
            grouplayers = fields - 4
            grouplist = []
            for i in range(grouplayers):
                grouplist.append(repo.split('/')[3+i])
            owner = "%2F".join(grouplist)

In any case, I think we should be perhaps be preserving the / characters, and then when the url gets assembled passing the owner through a urllib.parse.quote('/', safe='') call.

StingRayZA added a commit to StingRayZA/grimoirelab-perceval that referenced this issue Nov 3, 2020
This allows us to retain the '/' separation of URL pieces in any gitlab
urls that have been stored in the object. This change also lays the
groundwork for a fix in the -elk repository to allow multiple nested
gitlab group layers in gitlab URLs.

See also: chaoss/grimoirelab-elk#946

Signed-off-by: Raimund Hook <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants