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

Rework che-theia build process to not use source linking #16852

Open
tsmaeder opened this issue May 6, 2020 · 14 comments
Open

Rework che-theia build process to not use source linking #16852

tsmaeder opened this issue May 6, 2020 · 14 comments
Assignees
Labels
area/plugins kind/enhancement A feature request - must adhere to the feature request template. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P2 Has a minor but important impact to the usage or development of the system. sprint/current

Comments

@tsmaeder
Copy link
Contributor

tsmaeder commented May 6, 2020

Currently, we're linking source folders in order build che theia, we have the following structure ('->' being a symlink):

/theia
  /.git
  ...
  /plugins
    ->/theia/che/che-theia/plugins/task-plugin
    ...
  /extensions
    ->/theia/che/che-theia/extensions/eclipse-che-theia-about
  /che
    /che-theia
    /.git
    ...
    /plugins
      /task-plugin
    /extensions
      /eclipse-che-theia-about

The problem with this is that the build process does not handle source links very well: for one things, there will be two node_modules folder: one inside /theia and one inside /theia/che/che-theia. The fact that cd /projects/theia && yarn becomes broken when you rebuild a che plugin or extension seems to be a consequence of this (deleting both node_modules directories fixes the problem).
Since the build only works if the che-theia folder is located inside the theia folder, there is an additional drawback: the theia git tools cannot be used for changes in che-theia, because theia can't handle the case of nested git repos, it seems.

My proposal is to move to a setup that is based on yarn link. The idea is to have che-theia as a separate repository and to yarn link $package the theia packages in the appropriate places. The setup would look like this:

/theia
...just a vanilla theia install with all the packages linked to ~/.config/yarn/link
/che-theia
/assembly
...
/extensions
...
/plugins
...

I was able to almost make this work in a day an it seemed to address the problems mentioned above. I think investing some more time would be worth the time.

@tsmaeder tsmaeder added the kind/enhancement A feature request - must adhere to the feature request template. label May 6, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label May 6, 2020
@benoitf
Copy link
Contributor

benoitf commented May 6, 2020

I think it's something that can be done properly/smoothly only with yarn 2

@tsmaeder
Copy link
Contributor Author

tsmaeder commented May 6, 2020

Let's give it a try, shall we?

@tsmaeder
Copy link
Contributor Author

tsmaeder commented May 6, 2020

And why would it not work with yarn 1.x?

@l0rd l0rd added area/editor/theia Issues related to the che-theia IDE of Che severity/P2 Has a minor but important impact to the usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels May 6, 2020
@tsmaeder
Copy link
Contributor Author

@benoitf ?

@benoitf
Copy link
Contributor

benoitf commented May 15, 2020

One issue is yarn link is considering links to be folders, not packages
so there are issues with transitive dependencies / peer dependencies
yarnpkg/yarn#2914

portal: might be the savior:
https://dev.to/arcanis/introducing-yarn-2-4eh1#new-protocol-raw-portal-endraw-

https://yarnpkg.com/features/protocols#whats-the-difference-between-link-and-portal

Also the fact that we can store the dependencies should improve velocity.

@tsmaeder
Copy link
Contributor Author

@benoitf I've read the linked issue, but I don't really understand why it would block us: the issues seems to state the yarn does not call install on the library packages (in our case: the theia packages). But we could do that ourselves when necessary.
What we need is this:

  1. For our packages to be compiled against the correct version of upstream packages, assuming we have built those correct.y
  2. When packaging a build target with webpack or other tools, we need to pick up all dependencies and the proper version of the dependencies

Could you spell out how the yarn link behavior is breaking those requirements? It is not clear to me from reading the issue.

@ericwill ericwill mentioned this issue Nov 24, 2020
34 tasks
@ericwill ericwill mentioned this issue Dec 3, 2020
34 tasks
@ericwill ericwill added this to the 7.24 milestone Dec 8, 2020
@nickboldt nickboldt modified the milestones: 7.24, 7.25 Jan 8, 2021
@azatsarynnyy azatsarynnyy added area/plugins and removed area/editor/theia Issues related to the che-theia IDE of Che labels Jan 14, 2021
@ericwill ericwill mentioned this issue Jan 14, 2021
33 tasks
@tsmaeder
Copy link
Contributor Author

IMO, two further changes could be made to make the build even simpler:

  1. Don't have che-theia init override the theia version in the package.json files: it makes it impossible to check in what was tested. Instead, check in the version that is used.
  2. Don't generate the assembly in che-theia init. Instead, check it into the repo

@nickboldt
Copy link
Contributor

No immediate concerns w/ this for downstream, assuming that the existing method for getting che-theia code into crw-theia remains compatible after your changes (or else we'd rework the crw build.sh script to accommodate your changes).

@azatsarynnyy
Copy link
Member

It also should be checked that the proposed changes don't break the release flow.
The release script relies on some important files, such as:

@sunix
Copy link
Contributor

sunix commented Jan 20, 2021

Build done in CI and developer environment (che-theia in che) should be using the same script.

@ericwill ericwill modified the milestones: 7.25, 7.26 Jan 20, 2021
@ericwill ericwill mentioned this issue Feb 4, 2021
35 tasks
@ericwill ericwill removed this from the 7.26 milestone Feb 8, 2021
@ericwill ericwill added this to the 7.27 milestone Feb 8, 2021
@tsmaeder
Copy link
Contributor Author

tsmaeder commented Feb 17, 2021

I believe the concrete steps to implement linkless builds would be the following:

  1. move the static assembly inside the che-theia project and commit it with the repo and remove the assembly generation step from che-theia init. I think the code is static enough that we can just run it when needed. When that is needs to be analyzed.
  2. Add a "--theia-version=" parameter to che-theia init. All dependencies on @Theia packages in che-theia will be changed to this version. Default is "next". So by default, no changes will be made to the checked-in code
  3. Add a "--theia-source=" parameter. If present, che-theia init will clone theia and checkout the given version. The appropriate packages are yarn-linked in the che-theia/node_modules folder. We should support checking out branches, tags and specific commits as well as forks of theia. If the parameter is missing, we don't check anything out but build against @Theia packages from the npm registry.
  4. fix build scripts to use the new parameters.
  5. fix build scripts to package theia and che-theia artifacts from the new correct locations

@tsmaeder
Copy link
Contributor Author

Just found another case where our current structure is not working: After building plugins (.foreach_yarn), you'll have to clean out theia/che/che-theia/node_modules if you want to be sure that all extensions are finding the same node modules when you run the back end. There is a module called async-mutex that is only referenced by the che workspace plugins. As such, it will not be installed when you do a yarn in the theia folder and you have to install it manually.

@ericwill ericwill mentioned this issue Feb 25, 2021
46 tasks
@ericwill ericwill modified the milestones: 7.27, 7.28 Mar 2, 2021
@ericwill ericwill mentioned this issue Mar 18, 2021
46 tasks
@ericwill ericwill modified the milestones: 7.28, 7.29 Mar 24, 2021
@tsmaeder
Copy link
Contributor Author

tsmaeder commented Apr 1, 2021

The plan of attack in #16852 (comment) has been changed slightly:

  1. Provide che-theia commands for generate (generates assembly folder inside che-theia folder), link (sets up yarn linking to compile agains theia source) and 'updateDependencies` (updates the version of the relevant @Theia dependencies in all che-theia package.json files)
  2. Fix build scripts to use the new targets instead of che-theia init
  3. Remove che-theia init and related code.
  4. Remove assembly generation step if possible.

@ericwill ericwill mentioned this issue Apr 8, 2021
42 tasks
@ericwill ericwill modified the milestones: 7.29, 7.30 Apr 14, 2021
@ericwill ericwill modified the milestones: 7.30, 7.31 May 4, 2021
@ericwill ericwill removed this from the 7.31 milestone Jun 4, 2021
@che-bot
Copy link
Contributor

che-bot commented Dec 6, 2021

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 6, 2021
@che-bot che-bot closed this as completed Dec 13, 2021
@tsmaeder tsmaeder reopened this Dec 13, 2021
@tsmaeder tsmaeder added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins kind/enhancement A feature request - must adhere to the feature request template. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P2 Has a minor but important impact to the usage or development of the system. sprint/current
Projects
None yet
Development

No branches or pull requests

8 participants