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 are not displayed in the sidecar component #20498

Closed
svor opened this issue Sep 21, 2021 · 11 comments
Closed

Commands are not displayed in the sidecar component #20498

svor opened this issue Sep 21, 2021 · 11 comments
Assignees
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.

Comments

@svor
Copy link
Contributor

svor commented Sep 21, 2021

Describe the bug

The Workspace view displays commands only for dev component, but they are not displayed for sidecar plugins.
For example if a devfile contains a component like:

  - id: ms-python/python/latest
    type: chePlugin
    alias: python-plugin

and a command:

  - name: Second command
    actions:
      - type: exec
        command: echo 'Command was finished'
        component: python-plugin

This command won't be displayed in the Workspace view.

Che version

7.36@latest

Steps to reproduce

  1. Create a workspace by using
apiVersion: 1.0.0
metadata:
  name: test-workspace
components:
  - mountSources: true
    memoryLimit: 512Mi
    type: dockerimage
    alias: maven
    image: 'quay.io/eclipse/che-java11-maven:next'
  - id: ms-python/python/latest
    type: chePlugin
    alias: python-plugin
commands:
  - name: First command
    actions:
      - type: exec
        command: echo 'Command was finished'
        component: maven
  - name: Second command
    actions:
      - type: exec
        command: echo 'Command was finished'
        component: python-plugin
  1. Take a look at the Workspace view where python sidecar is displayed.

Expected behavior

Python sidecar's command Second command should be displayed in the Workspace view

Runtime

minikube

Screenshots

screenshot-nimbus-capture-2021 09 21-13_07_36

Installation method

chectl/latest

Environment

Linux

Eclipse Che Logs

No response

Additional context

No response

@svor svor added kind/bug Outline of a bug - must adhere to the bug report template. team/plugins severity/P1 Has a major impact to usage or development of the system. area/plugins sprint/next labels Sep 21, 2021
@svor svor mentioned this issue Sep 23, 2021
25 tasks
@svor svor added this to the 7.38 milestone Sep 29, 2021
@tsmaeder
Copy link
Contributor

tsmaeder commented Oct 4, 2021

This problem arises from the code in containers-service.ts#41:

      const devfileComponent = (devfile.components || []).find(component => component.name === componentStatus.name);

The code tries to match the the name fields from "componentStatus" and "devfile.components". However, the names don't match for plugins: For example if I assign the alias "jsdebug" to the a plugin, the name on componentStatus.name is something like 'jsdebugxyz', while devfile.components[i].name is 'jsdebug'.

I belive the correct thing would be to have the component name in the componentStatus.name field, but I'll defer judgment as to what the correct matching policy is to @skabashnyuk, I guess.

@svor
Copy link
Contributor Author

svor commented Oct 5, 2021

does it make sense to have a field alias into componentStatus to have a connection?
@tsmaeder @skabashnyuk WDYT?

@skabashnyuk
Copy link
Contributor

skabashnyuk commented Oct 5, 2021

@svor would it be better to rethink this issue in devfile 2.x context?

@svor
Copy link
Contributor Author

svor commented Oct 5, 2021

we have a customer request for this: https://issues.redhat.com/browse/CRW-2052

@svor
Copy link
Contributor Author

svor commented Oct 5, 2021

@tsmaeder could you please clarify a bit why it works for dev component and doesn't work for plugin component.

@tsmaeder
Copy link
Contributor

tsmaeder commented Oct 5, 2021

Because for non-plugin components, the name is the same in both the both instances: for example, it's "mvn" not "mvnxyz".

@skabashnyuk
Copy link
Contributor

That is how runtime of such a workspace is looks like

{
  "links": {
    "self": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/api/workspace/workspaceahwjlrdppt1mwtpv",
    "ide": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/user1/test-workspace",
    "environment/statusChannel": "wss://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/api/websocket",
    "environment/outputChannel": "wss://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/api/websocket"
  },
  "attributes": {
    "org.eclipse.che.runtimes_id": "runtimesce4x6c33x6acf1fm",
    "infrastructureNamespace": "user1-che",
    "updated": "1633439462101",
    "created": "1633439461485"
  },
  "namespace": "user1",
  "temporary": false,
  "id": "workspaceahwjlrdppt1mwtpv",
  "status": "RUNNING",
  "runtime": {
    "machines": {
      "che-jwtproxy": {
        "attributes": {
          "memoryLimitBytes": "134217728",
          "memoryRequestBytes": "15728640",
          "source": "tool",
          "cpuRequestCores": "0.03",
          "cpuLimitCores": "0.5"
        },
        "status": "RUNNING"
      },
      "maven": {
        "attributes": {
          "component": "maven",
          "memoryRequestBytes": "209715200",
          "memoryLimitBytes": "536870912",
          "source": "recipe",
          "cpuLimitCores": "0.0",
          "cpuRequestCores": "0.0"
        },
        "status": "RUNNING"
      },
      "che-machine-exec1td": {
        "attributes": {
          "plugin": "eclipse/che-theia/next",
          "memoryRequestBytes": "33554432",
          "memoryLimitBytes": "134217728",
          "source": "tool",
          "cpuLimitCores": "0.5",
          "cpuRequestCores": "0.03"
        },
        "servers": {
          "terminal": {
            "url": "wss://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server9hbakb8g-jwtproxy/server-4403/",
            "attributes": {
              "internal": "false",
              "port": "3333",
              "discoverable": "false",
              "urlRewriteSupported": "true",
              "cookiesAuthEnabled": "true",
              "secure": "true",
              "type": "collocated-terminal",
              "endpointOrigin": "/server9hbakb8g-jwtproxy/server-4403/"
            },
            "status": "RUNNING"
          }
        },
        "status": "RUNNING"
      },
      "vscode-pythons8l": {
        "attributes": {
          "component": "python-plugin",
          "plugin": "ms-python/python/latest",
          "memoryLimitBytes": "536870912",
          "memoryRequestBytes": "20971520",
          "source": "tool",
          "cpuRequestCores": "0.03",
          "cpuLimitCores": "0.5"
        },
        "status": "RUNNING"
      },
      "theia-idezvc": {
        "attributes": {
          "plugin": "eclipse/che-theia/next",
          "memoryRequestBytes": "67108864",
          "memoryLimitBytes": "512000000",
          "source": "tool",
          "cpuLimitCores": "1.5",
          "cpuRequestCores": "0.1"
        },
        "servers": {
          "webviews": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server9hbakb8g-jwtproxy/webviews/",
            "attributes": {
              "internal": "false",
              "port": "3100",
              "discoverable": "false",
              "urlRewriteSupported": "true",
              "unique": "true",
              "cookiesAuthEnabled": "true",
              "secure": "true",
              "type": "webview",
              "endpointOrigin": "/server9hbakb8g-jwtproxy/webviews/"
            },
            "status": "UNKNOWN"
          },
          "mini-browser": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server9hbakb8g-jwtproxy/mini-browser/",
            "attributes": {
              "internal": "false",
              "port": "3100",
              "discoverable": "false",
              "urlRewriteSupported": "true",
              "unique": "true",
              "cookiesAuthEnabled": "true",
              "secure": "true",
              "type": "mini-browser",
              "endpointOrigin": "/server9hbakb8g-jwtproxy/mini-browser/"
            },
            "status": "UNKNOWN"
          },
          "theia": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server9hbakb8g-jwtproxy/server-4402/",
            "attributes": {
              "internal": "false",
              "port": "3100",
              "discoverable": "false",
              "urlRewriteSupported": "true",
              "cookiesAuthEnabled": "true",
              "secure": "true",
              "type": "ide",
              "endpointOrigin": "/server9hbakb8g-jwtproxy/server-4402/"
            },
            "status": "RUNNING"
          },
          "theia-dev": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server7h88o5ns-theia-idezvc/server-3130/",
            "attributes": {
              "internal": "false",
              "port": "3130",
              "discoverable": "false",
              "urlRewriteSupported": "true",
              "type": "ide-dev",
              "endpointOrigin": "/server7h88o5ns-theia-idezvc/server-3130/"
            },
            "status": "UNKNOWN"
          },
          "theia-redirect-3": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server7h88o5ns-theia-idezvc/server-13133/",
            "attributes": {
              "internal": "false",
              "port": "13133",
              "discoverable": "false",
              "endpointOrigin": "/server7h88o5ns-theia-idezvc/server-13133/",
              "urlRewriteSupported": "true"
            },
            "status": "UNKNOWN"
          },
          "theia-redirect-2": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server7h88o5ns-theia-idezvc/server-13132/",
            "attributes": {
              "internal": "false",
              "port": "13132",
              "discoverable": "false",
              "endpointOrigin": "/server7h88o5ns-theia-idezvc/server-13132/",
              "urlRewriteSupported": "true"
            },
            "status": "UNKNOWN"
          },
          "theia-redirect-1": {
            "url": "https://che-eclipse-che.apps.cluster-a660.a660.sandbox592.opentlc.com/server7h88o5ns-theia-idezvc/server-13131/",
            "attributes": {
              "internal": "false",
              "port": "13131",
              "discoverable": "false",
              "endpointOrigin": "/server7h88o5ns-theia-idezvc/server-13131/",
              "urlRewriteSupported": "true"
            },
            "status": "UNKNOWN"
          }
        },
        "status": "RUNNING"
      }
    },
    "activeEnv": "default",
    "commands": [
      {
        "commandLine": "echo 'Command was finished'",
        "name": "First command",
        "attributes": {
          "componentAlias": "maven",
          "machineName": "maven"
        },
        "type": "exec"
      },
      {
        "commandLine": "echo 'Command was finished'",
        "name": "Second command",
        "attributes": {
          "componentAlias": "python-plugin",
          "plugin": "ms-python/python/latest",
          "machineName": "vscode-pythons8l"
        },
        "type": "exec"
      }
    ],
    "machineToken": "eyJraW5kIjoibWFj"
  },
  "devfile": {
    "metadata": {
      "name": "test-workspace"
    },
    "components": [
      {
        "mountSources": true,
        "memoryLimit": "512Mi",
        "type": "dockerimage",
        "alias": "maven",
        "image": "quay.io/eclipse/che-java11-maven:next"
      },
      {
        "id": "ms-python/python/latest",
        "type": "chePlugin",
        "alias": "python-plugin"
      }
    ],
    "apiVersion": "1.0.0",
    "commands": [
      {
        "name": "First command",
        "actions": [
          {
            "type": "exec",
            "command": "echo 'Command was finished'",
            "component": "maven"
          }
        ]
      },
      {
        "name": "Second command",
        "actions": [
          {
            "type": "exec",
            "command": "echo 'Command was finished'",
            "component": "python-plugin"
          }
        ]
      }
    ]
  }
}

Can you explain what is missing? I can't see componentStatus here.

@tsmaeder
Copy link
Contributor

tsmaeder commented Oct 6, 2021

@skabashnyuk re: ComponentStatus maybe @benoitf can shed some light on the mapping of the che server web API and the API here: https://github.com/eclipse-che/che-theia/blob/8e61ae25ca90bdab2bba99a40fe48b6fa97c62ef/extensions/eclipse-che-theia-remote-api/src/common/devfile-service.ts#L15 I'm not familiar with that area of the code, t.b.h. (and there is no doc on those interfaces 🤷 )

However, the problem remains how to map vscode-pythons8l in your example to the component python-plugin in the case where we do or don't have an alias in the devfile. What's the documented policy?

@benoitf
Copy link
Contributor

benoitf commented Oct 6, 2021

hello, maybe the missing important piece of the discussion is that devfileV1 is converted to devfile v2 syntax and then we consume always devfile v2 objects on plug-ins/extensions in CheTheia

This might explain why people argue it's devfile v1 and other devfile v2

As a bug is reported on a devfile v1 then it's probably a bug in the converter.
for 'custom case' where we can't port directly devfile v1 to v2 with a simple mapping, we're adding attributes with the 'helper' information

Probably need to look at https://github.com/eclipse-che/che-theia/blob/909e6974240a6c137647dafe09dc23a8af7638e0/extensions/eclipse-che-theia-remote-impl-che-server/src/node/che-server-devfile-service-impl.ts#L591

and add a test usecase there: https://github.com/eclipse-che/che-theia/blob/909e6974240a6c137647dafe09dc23a8af7638e0/extensions/eclipse-che-theia-remote-impl-che-server/tests/node/che-server-devfile-service-impl.spec.ts

there is also https://github.com/eclipse-che/che-theia/blob/909e6974240a6c137647dafe09dc23a8af7638e0/extensions/eclipse-che-theia-remote-impl-che-server/src/node/che-server-devfile-service-impl.ts#L662

(in any case if there is a bug about a devfile v1 it's located in eclipse-che-theia-remote-impl-che-server implementation)

@svor
Copy link
Contributor Author

svor commented Oct 6, 2021

this bug is only about devfile v1

@svor svor mentioned this issue Oct 19, 2021
28 tasks
@svor svor modified the milestones: 7.38, 7.39 Oct 20, 2021
@svor svor removed the sprint/next label Oct 20, 2021
@svor svor mentioned this issue Nov 9, 2021
18 tasks
@svor svor removed this from the 7.39 milestone Nov 9, 2021
@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 2022
@che-bot
Copy link
Contributor

che-bot commented May 8, 2022

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 closed this as completed May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

5 participants