GitLab file resolver should support deeply nested repositories #22022
Labels
area/factory/server
Server side of factory implementation
kind/bug
Outline of a bug - must adhere to the bug report template.
new¬eworthy
For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes
severity/P1
Has a major impact to usage or development of the system.
sprint/next
status/release-notes-review-needed
Issues that needs to be reviewed by the doc team for the Release Notes wording
Milestone
Describe the bug
When attempting to create a workspace from a GitLab repository that is more than 2 levels deep (e.g. my.gitlab.com/group/subgrp1/subgrpN/repo.git), Che will fail to find the devfile.
Looking in
<cheUrl>/swagger/#/scm/resolveFile
, this can be easily seen by pluggin in the above sample URL:Sample curl from SWAGGER
Response:
It looks like the GitLabUrlParser is written to stop at two levels of depth per: https://github.com/eclipse-che/che-server/blob/main/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrlParser.java#L48-L52
However, as documented in the Gitlab Docs GitLab supports up to 20 levels of nesting. It's common for enterprise users to use sub groups to match their org hierarchy, which commonly goes beyond 2 levels.
Che version
7.58
Steps to reproduce
Create a GitLab repo with at least 3 levels of subgroups such as
https://my.gitlab.com/group/subgrp1/subgrpN/repo.git
, and put a devfile in it.Use SWAGGER or the curl below to try and fetch the devfile:
curl -X 'GET'
'https://devspaces.apps.my-cluster.p1.openshiftapps.com/api/scm/resolve?repository=https%3A%2F%2Fmy.gitlab.com%2Fgroup%2Fsubgrp1%2FsubgrpN%2Frepo.git&file=.devfile.yaml'
-H 'accept: /'
Expected behavior
Should return 200, and allow you to download the devfile
Runtime
OpenShift
Screenshots
No response
Installation method
OperatorHub
Environment
Linux
Eclipse Che Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: