Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Cannot bind project to appsody stacks in the built-in Kabanero repo #1645

Open
makandre opened this issue Jan 7, 2020 · 8 comments
Open
Labels
area/extensions Issues for the codewind extensions team kind/bug kind/enhancement

Comments

@makandre
Copy link
Contributor

makandre commented Jan 7, 2020

Codewind version: 0.7.0
OS:

Che version:
IDE extension version:
IDE version:
Kubernetes cluster:

Description:

(using VSCode)

  1. Enable only the Kabanero repo in the Template Sources Manager
  2. Attempt to bind a project to Codewind. If prompted to confirm the detected type, answer No
  3. The next prompt should give you a list of stacks in the Kabanero repo that you can bind to, but it will be empty.

This is the followup issue to #1068. The way that the kabanero repo is hardcoded here means that it is only known to Codewind but not the appsody CLI. So when the list of stacks is queried from the appsody CLI, it returns nothing

Workaround:

@makandre
Copy link
Contributor Author

makandre commented Jan 8, 2020

/area portal

@tobespc
Copy link
Contributor

tobespc commented Jan 9, 2020

This is a scenario that has not been coded for, do you have any thoughts on how this should work ?

@makandre
Copy link
Contributor Author

makandre commented Jan 9, 2020

If a repo is added from IDE via the Template sources manager, it will go through all the proper code paths to add it to both Codewind and the appsody CLIs (both local IDE copy and one in PFE) This was implemented in #564. So I think we would need to programatically add the Kabanero repo this way, rather than hardcoding it.

@hhellyer
Copy link
Contributor

@makandre - From what you said above it sounds like the Kabanero templates need something to be run outside PFE (ie the appsody client on the users machine)? If so the best fix it probably to remove the kabanero repo from PFE and have the IDE's add it when they make a new connection. We can't do anything in PFE that affects the users machine outside the container.

I'll tag the ui plugins in as well because this probably needs discussing with them at techtopics. Can all the UI plugins run the right appsody commands to initialise the templates? (Is appsody supported in all the different IDEs?)

@hhellyer hhellyer added area/eclipse-ide Issue associated with the Codewind Eclipse plugin area/intellij-ide Issue associated with the codewind intellij plugin area/vscode-ide Issue associated with the Codewind VS Code/Theia extension labels Apr 28, 2020
@makandre
Copy link
Contributor Author

@hhellyer When IDE calls cwctl to create/validate a project, that is what runs the appsody init command on the local system. And it's done in a generic manner by looking at what commands needs to be run as defined in an extension's codewind.yaml file

(eclipse-archived/codewind-installer#119)

@hhellyer
Copy link
Contributor

@makandre - Ok, that's simpler. The comment in #1645 (comment) implied there was work to do when we added template repositories as well.

@hhellyer hhellyer added area/extensions Issues for the codewind extensions team and removed area/eclipse-ide Issue associated with the Codewind Eclipse plugin area/intellij-ide Issue associated with the codewind intellij plugin area/portal area/vscode-ide Issue associated with the Codewind VS Code/Theia extension labels Apr 28, 2020
@hhellyer
Copy link
Contributor

@makandre - I've done some more investigation and I think the problem is an interaction between the kabanero template list and the appsody extension.

With all but the Kabanero template repository disabled api/v1/project-types returns no project types:

$ curl http://localhost:10000/api/v1/project-types
[]

This is what the VSCode plugin uses to populate the project types you can bind to.

We also see this message in the PFE logs:

Appsody extension: failed to retrieve project types
Command failed: /codewind-workspace/.extensions/codewind-appsody-extension/appsody list undefined -o json
[Error] cannot locate repository named undefined

This is because sourceId here is undefined on non-Appsody extension created templates: https://github.com/eclipse/codewind/blob/master/src/pfe/portal/routes/projectTypes.route.js#L94

The templates in the Appsody repository define sourceId via here: https://github.com/eclipse/codewind-appsody-extension/blob/b72b7cf8b0cff7d7881eac712745a9af3951f0d6/templatesProvider.js#L61 which looks like it sets the id for the repo and here https://github.com/eclipse/codewind/blob/master/src/pfe/portal/modules/Templates.js#L470 which puts the repository.id field into each templates sourceId field.

The problem boils down to not knowing which repository in Appsody each Kabanero template belongs to. Most of the Appsody templates all seem to be in incubator which means when we try to list the project types we also run:

/codewind-workspace/.extensions/codewind-appsody-extension/appsody list incubator -o json

and this generates a list of types from the appsody extensions but doesn't when we disable the appsody repository and the others.

I can resolve this by changing the definition of the kabanero repo here:
https://github.com/eclipse/codewind/blob/master/src/pfe/portal/modules/Templates.js#L35
to add an extra field id: 'incubator' but I don't know if that's a good idea, Kabanero may use more than just the template types appsody lists with incubator.

Since this needs someone with more Appsody/Kabanero knowledge to resolve I'm going to assign it to area/extensions to decide how this interaction between the Kabanero repo and the Appsody extension should be resolved.

@hhellyer hhellyer removed their assignment Apr 28, 2020
@makandre
Copy link
Contributor Author

I can resolve this by changing the definition of the kabanero repo here:
https://github.com/eclipse/codewind/blob/master/src/pfe/portal/modules/Templates.js#L35
to add an extra field id: 'incubator' but I don't know if that's a good idea, Kabanero may use more than just the template types appsody lists with incubator.

True, adding an id here probably resolves the missing ID symptoms you've described. But the root problem is we should not be "hardcoding" the Kabanero repo here. Doing so only adds it to Codewind's repository_list.json file. If you do appsody repo list (either locally ~/.codewind/<version>/appsody or inside PFE), Kabanero won't be there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/extensions Issues for the codewind extensions team kind/bug kind/enhancement
Projects
None yet
Development

No branches or pull requests

4 participants