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

GitLab file resolver should support deeply nested repositories #22022

Closed
etsauer opened this issue Feb 27, 2023 · 1 comment
Closed

GitLab file resolver should support deeply nested repositories #22022

etsauer opened this issue Feb 27, 2023 · 1 comment
Assignees
Labels
area/factory/server Server side of factory implementation kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy 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

Comments

@etsauer
Copy link

etsauer commented Feb 27, 2023

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

@etsauer etsauer added the kind/bug Outline of a bug - must adhere to the bug report template. label Feb 27, 2023
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Feb 27, 2023
@AObuchow AObuchow added area/factory/server Server side of factory implementation severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Feb 28, 2023
@ibuziuk ibuziuk mentioned this issue Mar 17, 2023
50 tasks
@tolusha tolusha added this to the 7.63 milestone Mar 20, 2023
@tolusha tolusha closed this as completed Mar 20, 2023
@tolusha tolusha mentioned this issue Mar 20, 2023
45 tasks
@l0rd l0rd added new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Mar 30, 2023
@devstudio-release
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/factory/server Server side of factory implementation kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy 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
Projects
None yet
Development

No branches or pull requests

7 participants