Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

fix(workpace-plugin): Importing several private projects in a single devfile #959

Conversation

sunix
Copy link
Contributor

@sunix sunix commented Jan 5, 2021

What does this PR do?

  • Fix workspace start initial git cloning when multiple private projects are defined in the devfile.
  • Only ask for credentials once if cloning from the same host.
  • Adding a devfile.yaml for the workspace plugin (simplify review).
  • Fix jest import errors in Che
  • Include unit tests

What issues does this PR fix or reference?

Fix eclipse-che/che#18494

How to test this PR?

  1. create 2 private projects in Github with README files
  2. start a workspace from the given devfile.
  3. build the plugin with the predifined tasks
  4. run che-theia with the predefined task
  5. go to the dashboard and add the private projects to the devfile of the running workspace. For instance (adapt the location with the ones you have created):
      - name: private-1
        source:
          location: 'https://github.com/sunix/test-private-1'
          type: github
      - name: private-2
        source:
          location: 'https://github.com/sunix/test-private-2'
          type: github
    
    SAVE the devfile DO NOT APPLY, DO NOT RESTART THE WORKSPACE!
  6. back to che-theia, open the preview Url in a new tab, try to fill the username and password, observe the bug
  7. stop the run task and close the preview tab, remove the content of /tmp/theiadev_projects from a terminal of che-theia-next-dev cotainer.
  8. check the workspace devfile (dashboard) that the private projects are still there.
  9. from the Github PR panel, checkout this PR
  10. rebuild with the predifined task
  11. rerun che-theia dev with the predifined task
  12. open the Preview Url in a new tab.
  13. fill your Github.com username and password, it should ask for it only once.
  14. observe that the projects are cloned with the README files.

PR Checklist

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

Reviewers

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

Happy Path Channel

HAPPY_PATH_CHANNEL=next

@che-bot
Copy link
Contributor

che-bot commented Jan 5, 2021

❌ E2E Happy path tests failed ❗

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:959
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:959

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@sunix
Copy link
Contributor Author

sunix commented Jan 5, 2021

[crw-ci-test]

@che-bot
Copy link
Contributor

che-bot commented Jan 5, 2021

❌ E2E Happy path tests failed ❗

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:959
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:959

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@benoitf
Copy link
Contributor

benoitf commented Jan 6, 2021

[crw-ci-test]

@benoitf
Copy link
Contributor

benoitf commented Jan 6, 2021

FYI I switched happy path channel to next

@che-bot
Copy link
Contributor

che-bot commented Jan 6, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:959
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:959

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@@ -0,0 +1,72 @@
apiVersion: 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it's a good practice to introduce devfiles in each directory ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This a devfile to work on the workspace plugin, as this project lives in a subdirectory of the git repo, it looks good to have it there, next to the package.json, etc ...

Copy link
Contributor

Choose a reason for hiding this comment

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

but it's part of a yarn workspace so you should use top-level folder/definitions/devfile anyway to inherits from all workspace definition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok but isn't it overkill when a dev just want to work on 1 plugin ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be useful to have the devfile here, even just for reference purposes. It could be useful to point for new contributors in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This devfile is for coding the workspace plugin without having to rebuild che-theia and all the other plugins. It doesn't make sense to have it elsewhere.

Copy link
Contributor Author

@sunix sunix Jan 7, 2021

Choose a reason for hiding this comment

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

The maintenance issue is not related to the location of the devfiles. but how a devfile could be extended: so the devfile for the workspace plugin (that would be in the workspace plugin folder) could extend a more generic devfile for built-in plugins but adding its own specifics (for instance, custom commands, etc ...). Maybe it is in the scope of devfile 2.
Parent pom.xml files are usually there to share BoM. But without these sharing capabilities, we would have pom.xml files for each module that would be also hard to maintain. Anyway a module would have its own pom.xml.

Anyway, the devfile for the workspace plugin has to stay here because it would setup the right workspace for the workspace-plugin developer flow.

Copy link
Contributor Author

@sunix sunix Jan 7, 2021

Choose a reason for hiding this comment

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

and then if the suggestion is to move that devfile to the devfiles directory I don't see how easier it would be to maintain. Or is the suggestion not to have devfile at all and let all the developers loosing time to setup an dev environment to work on each individual plugins?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the suggestion is to have a a single devfile for developing che-theia.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is that devfile https://github.com/eclipse/che-theia/blob/master/devfiles/che-theia-all.devfile.yaml but it is doing way too many things when it is to work a a particular plugin.

@@ -8,6 +8,8 @@
* SPDX-License-Identifier: EPL-2.0
***********************************************************************/

import 'jest';
Copy link
Contributor

Choose a reason for hiding this comment

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

looks odd to import jest ?

Copy link
Contributor Author

@sunix sunix Jan 6, 2021

Choose a reason for hiding this comment

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

This was the only way I could find to get rid of the errors reported by the typescript plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

but jest is added on tsconfig types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no idea ...
Selection_142 maybe a bug in typescript plugin.

Do you want to remove these imports?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that already (see the M in tsconfig.ts in the screenshoft above). And just retried but it doesn't get rid of the error message. Maybe a bug in the plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benoitf I rebased and removed the imports

@sunix sunix requested a review from benoitf January 8, 2021 11:31
@che-bot
Copy link
Contributor

che-bot commented Jan 8, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:959
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:959

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

sunix added 4 commits January 12, 2021 08:52
…devfile

Signed-off-by: Sun Tan <sutan@redhat.com>
Signed-off-by: Sun Tan <sutan@redhat.com>
Signed-off-by: Sun Tan <sutan@redhat.com>
Signed-off-by: Sun Tan <sutan@redhat.com>
@sunix sunix force-pushed the fix-workspace-plugin-import-multiple-private-projects branch from 3bda7d6 to 004edb9 Compare January 12, 2021 10:14
Signed-off-by: Sun Tan <sutan@redhat.com>
@che-bot
Copy link
Contributor

che-bot commented Jan 12, 2021

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:959
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:959

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@benoitf
Copy link
Contributor

benoitf commented Jan 12, 2021

@sunix there is still the devfile

@sunix
Copy link
Contributor Author

sunix commented Jan 12, 2021

@sunix there is still the devfile

I thought we were ok

  1. to keep it for now
  2. work on A single dogfooding devfile for che-theia che#18763
  3. remove this devfile as soon as we would A single dogfooding devfile for che-theia che#18763 as well as other devfiles located in devfiles.

@sunix sunix merged commit ff88e4e into eclipse-che:master Jan 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing several private projects in a single devfile fails
5 participants