Uploaded image for project: 'Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) '
  1. Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces)
  2. CRW-4154

[RN] GitLab file resolver should support deeply nested repositories

XMLWordPrintable

    • False
    • None
    • False
    • Release Notes
    • Hide
      = Undetected devfiles in GitLab subgroup repositories

      Before this update, {prod-short} did not detect devfiles in GitLab repositories at more link:https://docs.gitlab.com/ee/user/group/subgroups/[subgroup levels]. {prod-short} has been updated to fetch GitLab repositories at all subgroup levels.
      Show
      = Undetected devfiles in GitLab subgroup repositories Before this update, {prod-short} did not detect devfiles in GitLab repositories at more link: https://docs.gitlab.com/ee/user/group/subgroups/ [subgroup levels]. {prod-short} has been updated to fetch GitLab repositories at all subgroup levels.
    • 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&#45;che/che&#45;server/blob/main/wsmaster/che&#45;core&#45;api&#45;factory&#45;gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrlParser.java#L48&#45;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

              rhn-ecs-pkovar Petr Kovar (Inactive)
              jiralint.codeready Bot Codeready
              Shmaraiev Oleksandr Shmaraiev Oleksandr
              Max Leonov Max Leonov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: