eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

Ability to create workspace from devfile path in git repo URL #23169

Open AObuchow opened 2 months ago

AObuchow commented 2 months ago

Is your enhancement related to a problem? Please describe

It's unintuitive how giving the direct path to a devfile in a git repo doesn't work for creating a workspace. For example, if you try starting a workspace from the following URL https://github.com/che-samples/web-nodejs-sample/blob/main/devfile.yaml, you'll get the following error: image

Instead, you need to use the following URL https://github.com/che-samples/web-nodejs-sample/.

Describe the solution you'd like

It'd be nice if you could start a workspace by providing a git repo URL with the branch name & path to a devfile, such as https://github.com/che-samples/web-nodejs-sample/blob/main/devfile.yaml.

When doing so, I'd expect this to be interpreted as the Dashboard git repo options having the branch selected as well as the devfile path configured:

image

Describe alternatives you've considered

No response

Additional context

No response

RomanNikitenko commented 2 months ago

@AObuchow it's possible to create a workspace from a raw devfile, like https://raw.githubusercontent.com/RomanNikitenko/web-nodejs-sample/refs/heads/testPR/devfile.yaml

But I agree about

It's unintuitive how giving the direct path to a devfile in a git repo doesn't work for creating a workspace

and I don't know if the raw devfile way can be used as a workaround for the described issue...

ibuziuk commented 1 month ago

@AObuchow does df parameter work? https://eclipse.dev/che/docs/stable/end-user-guide/url-parameter-for-the-devfile-file-name/

AObuchow commented 1 month ago

@ibuziuk The df (devfilePath) parameter works, but only if the repo is given in the expected https://<che_fqdn>#<git_repository_url>?df=<filename>.yaml format, for example https://github.com/che-samples/web-nodejs-sample?devfilePath=devfile.yaml.

If you try taking the git repo URL that includes the branch & the devfile path, and then concatenate ?devfilePath=<path-to-devfile>, such as https://github.com/che-samples/web-nodejs-sample/blob/main/devfile.yaml?devfilePath=devfile.yaml it will not work and you'll get the same error as I originally reported.

image

Something that might be insightful: the above error is complaining about the Git provider: The Git provider is not supported.. I'm not exactly sure how the dashboard factory logic works, but it might be that the git provider regex is not configured to catch this case (where a git branch using /blob/ is provided, as well as a path to the devfile).

Additional testing

I tried removing the devfile file path from the URL, i.e.: https://github.com/che-samples/web-nodejs-sample/blob/main/devfile.yaml -> https://github.com/che-samples/web-nodejs-sample/blob/main, and this is not recognized as a valid git URL: image

Note that https://github.com/che-samples/web-nodejs-sample/blob/main actually redirects you to https://github.com/che-samples/web-nodejs-sample/tree/main (/blob/ gets replaced with /tree/).

The link with /tree/ will work when provided in the Dashboard: https://github.com/che-samples/web-nodejs-sample/tree/main