-
Task
-
Resolution: Done
-
Critical
-
3.4.0.GA
-
False
-
None
-
False
-
Release Notes
-
-
Bug Fix
-
Done
-
-
Synced from eclipse/che issue
https://github.com/eclipse/che/issues/22022
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
curl -X 'GET' \ '[https://devspaces.apps. mycluster.p1.openshiftapps.com/api/scm/resolve?repository=https%3A%2F%2Fmy.gitlab.com%2Fgroup%2Fsubgrp1%2FsubgrpN%2Frepo.git&file=.devfile.yaml'](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%27) \ -H 'accept: */*'
Response:
{ "message": "Cannot find suitable file resolver for the provided URL." }
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