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

Commands API for Workspace.Next #9546

Closed
garagatyi opened this issue Apr 26, 2018 · 10 comments
Closed

Commands API for Workspace.Next #9546

garagatyi opened this issue Apr 26, 2018 · 10 comments
Assignees
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.

Comments

@garagatyi
Copy link

Description

In workspace next when a client starts a workspace, with current API definitions, it’s complicated to retrieve the full list of commands, in particular, the commands defined at a service level.
A client has to get features, then services from these features, eliminate duplications, get all the commands from all the containers in services, match them with machines. After that, it can use it for commands execution UI.
This approach is too complicated. We should consider changes in the APIs that would simplify it dramatically.
Possible solutions are:

  • add commands list to the workspace runtime. Then workspace strat flow can add commands from features to the appropriate machine
  • create new Command API that would allow fetching commands by workspace/machine/etc.
@ghost
Copy link

ghost commented Apr 26, 2018

@garagatyi is this an epic? If so please label it accordingly. Thanks

@garagatyi
Copy link
Author

I'm not sure whether this is an epic. AFAIK we haven't discussed what has to be done with commands in Workspace NEXT, so can't say whether it is something like an epic or a regular task.

@ghost ghost added the kind/question Questions that haven't been identified as being feature requests or bugs. label May 7, 2018
@l0rd l0rd mentioned this issue Jun 29, 2018
24 tasks
@l0rd
Copy link
Contributor

l0rd commented Aug 1, 2018

@garagatyi does this issue still make sense?

@l0rd l0rd mentioned this issue Aug 3, 2018
57 tasks
@garagatyi
Copy link
Author

Yes, we have editor-commands field in the walking skeleton, but don't know what to do with this field on IDE side

@ghost ghost added kind/task Internal things, technical debt, and to-do tasks to be performed. and removed kind/question Questions that haven't been identified as being feature requests or bugs. labels Sep 10, 2018
@sleshchenko
Copy link
Member

add commands list to the workspace runtime. Then workspace strat flow can add commands from features to the appropriate machine

I think it's simple way that can be implemented quickly.
This issue blocks Devfile workflow since it may contain definitions of commands for Che Plugins.
I propose also implement an ability to specify pluginName in commands attributes that would indicate to which Che Plugin this command is related. Then Che Server would be able to resolve machine name on Che Plugin Broker phase and return configured command but with machine name specified in attributes.
As an alternative way - maybe be not resolving machine Name by Che Server and let client (IDE) resolve it according to metainformation of runtime machines (they should contain information which plugin provides it).
I prefer the first way because there is no need to implement matching for different editors.

@garagatyi WDYT about proposed functionality? Should I create a separate issue for it or it may be implemented in this issue?

@garagatyi
Copy link
Author

I'm OK with either way because I don't have strong opinion on that at the moment.

@garagatyi
Copy link
Author

Feel free to use this issue for the scope you are tackling.

@sleshchenko sleshchenko self-assigned this Nov 14, 2018
@sleshchenko sleshchenko added status/in-progress This issue has been taken by an engineer and is under active development. team/platform labels Nov 14, 2018
@sleshchenko
Copy link
Member

Now Workspace#Runtime#getCommands returns commands list which contains: commands from workspace config, commands from plugins. Also, command in workspace config may be configured to be executed in plugin's container, the plugin attribute should be specified and the format of the value is {pluginId}:{pluginVersion}, like "che-machine-exec-plugin:0.0.1". The Che Server will resolve machineName that belongs to a specified plugin. Example:
WorkpaceConfig

{
  "defaultEnv": "default",
  "environments": {
    "default": {
      ...
    }
  },
  "projects": [],
  "name": "che7",
  "attributes": {
    "editor": "org.eclipse.che.editor.theia:1.0.0",
    "plugins": "che-machine-exec-plugin:0.0.1"
  },
  "commands": [
    {
      "commandLine": "echo Hello From Exec Plugin",
      "name": "hello-plugin",
      "attributes": {
        "previewUrl": "",
        "goal": "Build",
        "plugin": "che-machine-exec-plugin:0.0.1"
      },
      "type": "mvn"
    },
    {
      "commandLine": "echo Hello From Runtime",
      "name": "hello-runtime",
      "attributes": {
        "goal": "",
        "previewUrl": ""
      },
      "type": "custom"
    }
  ]
}

Runtime

{
  "machines": {
    "ws/theia-ide": {
         ...
      },
      "status": "STARTING"
    },
    "ws/che-machine-exec": {
      "servers": {
        "che-machine-exec": {
          "url": "ws://routeyjs82ne2-eclipse-che.192.168.0.108.nip.io",
          "attributes": {
            "type": "terminal",
            "internal": "false"
          },
          "status": "UNKNOWN"
        }
      },
      "status": "STARTING"
    }
    ...
  },
  "warnings": [],
  "activeEnv": "default",
  "commands": [
    {
      "commandLine": "echo Hello From Runtime",
      "name": "hello-runtime",
      "attributes": {
        "goal": "",
        "previewUrl": ""
      },
      "type": "custom"
    },
    {
      "commandLine": "echo Hello From Exec Plugin",
      "name": "hello-plugin",
      "attributes": {
        "goal": "Build",
        "previewUrl": "",
        "plugin": "che-machine-exec-plugin:0.0.1",
        "machineName": "ws/che-machine-exec"
      },
      "type": "mvn"
    }
  ],
  "machineToken": "...",
}

@sleshchenko sleshchenko removed the status/in-progress This issue has been taken by an engineer and is under active development. label Nov 27, 2018
@sleshchenko
Copy link
Member

A separate issue is created for IDEs adaptation #12053

@garagatyi
Copy link
Author

@sleshchenko thanks for the JSON!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

No branches or pull requests

3 participants