Skip to content

Support GitHub repository devfile url #793

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

Merged
merged 2 commits into from
Apr 11, 2025
Merged

Support GitHub repository devfile url #793

merged 2 commits into from
Apr 11, 2025

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Apr 8, 2025

What does this PR do?

Add an ability to start a workspace from the repository url of a devfile e.g. https://github.com/vinokurig/test/blob/master/devfile.yaml This will be an experimental feature and will be applied only for GitHub.

Since GitHub url defines branch as a segment of the file path e.g. https://github.com/user/repository/blob/branch/file, we can not distinguish a branch with / from the path. For instance we can have such path: /branch/with/slash/file in the url, so we can not parse it as <branch>/<path to file> as both branch and path may contain /, see.

In this implementation when parsing a file path from a url, we give the priority to the file path, so when parsing /branch/with/slash/file, we assume that branch => branch/with/slash and file path => file

With this solution we can generate RAW devfile url from a repository url like: https://github.com/user/repository/blob/branch/path/to/devfile.yaml, but we pass branch/path/to to the factory parameters, and as a result the project clone will fail and the default branch will be used. However, we do not break the existing functionality that allows to start a workspace with branch that has / in its name.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes eclipse-che/che#23390

How to test this PR?

  1. Deploy che with the pull request image: quay.io/eclipse/che-server:pr-793
  2. Start a workspace from a repository devfile url, e.g. https://github.com/vinokurig/test/blob/master/path/devfile.yaml

See: devfile from the directory path is resolved.

PR Checklist

As the author of this Pull Request I made sure that:

Release Notes

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@@ -128,6 +128,6 @@ public RemoteFactoryUrl parseFactoryUrl(String factoryUrl) throws ApiException {

@Override
public FactoryResolverPriority priority() {
return HIGHEST;
return LOWEST;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinokurig hmm, why raw Devfile has the lowest priority now?

Copy link
Contributor Author

@vinokurig vinokurig Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the repository devfile url may matc the RAW devfile url pattern, so we need to check the provider resolvers first.

@artaleks9
Copy link
Contributor

/retest

@openshift-ci openshift-ci bot removed the lgtm label Apr 9, 2025
@artaleks9
Copy link
Contributor

Verified on Eclipse Che with quay.io/eclipse/che-server:pr-793 - the functionality works properly

Copy link

openshift-ci bot commented Apr 10, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: artaleks9, ibuziuk, tolusha, vinokurig

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vinokurig vinokurig merged commit 54a2b1c into main Apr 11, 2025
28 checks passed
@vinokurig vinokurig deleted the che-23390 branch April 11, 2025 07:11
@devspacesbuild
Copy link

Build 3.21 :: server_3.x/400: Console, Changes, Git Data

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

Build 3.21 :: server_3.x/400: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/9147 triggered

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

Build 3.21 :: get-sources-rhpkg-container-build_3.x/9281: FAILURE

devspaces-operator-bundle : 3.x :: Failed in 67304261 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create workspace when pointing directly to a devfile.yaml
5 participants