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

Projects are not cloned after restarting the workspace using Eclipse Che: Restart Workspace from Local Devfile command #22722

Closed
vitaliy-guliy opened this issue Dec 5, 2023 · 3 comments
Assignees
Labels
area/editor/vscode Issues related to the Code OSS editor of Che area/editors kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.

Comments

@vitaliy-guliy
Copy link
Contributor

vitaliy-guliy commented Dec 5, 2023

Describe the bug

I created a workpsace with following devfile

schemaVersion: 2.2.0
metadata:
  name: java-spring-petclinic

# projects:
#   - name: nodejs-devfile-test
#     git:
#       remotes:
#         origin: https://github.com/vitaliy-guliy/nodejs-devfile-test.git

#   - name: lombok-project-sample
#     git:
#       remotes:
#         origin: https://github.com/vitaliy-guliy/lombok-project-sample.git

components:
  - name: tools
    container:
      image: quay.io/devfile/universal-developer-image:ubi8-latest
      memoryLimit: 1G
      mountSources: true

Then I opened the devfile in the editor, uncommented the projects section and launched Eclipse Che: Restart Workspace from Local Devfile.
After restarting the workspace, it appeared that projects were not being cloned to the file system, despite they are properly described in flattened devworkspace yaml file.

Che version

7.78@latest

Steps to reproduce

Expected behavior

Projects must be cloned to the file system

@vitaliy-guliy vitaliy-guliy added kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system. labels Dec 5, 2023
@amisevsk
Copy link
Contributor

amisevsk commented Dec 5, 2023

I just tested this on Che nightly: projects are indeed not being cloned after restart from local devfile; however, I don't see the additional projects in either the DevWorkspace CR, or the $DEVWORKSPACE_ORIGINAL_YAML nor $DEVWORKSPACE_FLATTENED_YAML.

It looks like the restart from local devfile action is ignoring projects in the local devfile.

@amisevsk
Copy link
Contributor

amisevsk commented Dec 5, 2023

Che Code explicitly overwrites the projects in the devfile after generating here:

  const currentDevfile = await devfileService.get();
  const projects = currentDevfile.projects || [];
  const pluginRegistryUrl = process.env.CHE_PLUGIN_REGISTRY_INTERNAL_URL;
  
  console.info(`Using ${pluginRegistryUrl} to generate a new Devfile Context`);
  const newContent = await devWorkspaceGenerator.generateDevfileContext({ devfilePath, editorContent: EDITOR_CONTENT_STUB, pluginRegistryUrl, projects: [] }, axiosInstance);
  if (newContent) {
    newContent.devWorkspace.spec!.template!.projects = projects;
    await devfileService.updateDevfile(newContent.devWorkspace.spec?.template);
  } else {
    throw new Error('An error occurred while generating new devfile context');
  }

@amisevsk amisevsk added area/editors area/editor/vscode Issues related to the Code OSS editor of Che labels Dec 5, 2023
@l0rd
Copy link
Contributor

l0rd commented Dec 6, 2023

I would be careful about fixing this bug: is it a user / customer issue? or is just us trying to make perfect something is works fine for user? Because that's a complicated subject and to address it we need to consider a lot of cases:

  • user add projects section: should we remove the existing project if it's not explicitly mentioned in new projects?
  • user completely remove projects section: should we start an empty workspace or should we keep an "implicit" project?
  • user removed one project from projects section: should we remove it from the code-workspace.json at restart if it's not in the devfile projects?
  • user has manually cloned a git repository in /projects/ and it was added to code-workspace.json but not in devfile.yaml: what should we do at restart?
  • what about starterProjects?

An simpler approach would be to ignore projects and starterProjects when starting from local devfile and support dependentProjects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/vscode Issues related to the Code OSS editor of Che area/editors kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.
Development

No branches or pull requests

3 participants