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

Different behavior between repo URL and devfile URL in factory #21433

Closed
amisevsk opened this issue May 30, 2022 · 5 comments
Closed

Different behavior between repo URL and devfile URL in factory #21433

amisevsk opened this issue May 30, 2022 · 5 comments
Labels
area/dashboard area/factory/dashboard Issues related to factories frontend (che user dashboard side) 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/P2 Has a minor but important impact to the usage or development of the system.

Comments

@amisevsk
Copy link
Contributor

Describe the bug

The behavior of factory URLs is different depending on if the URL points at e.g. a github repo versus a devfile.

  • When a github repo is used as the factory URL, the theia editor is added to the workspace, along with some environment variables and a different container arguments (to run the remote-runtime)
  • When the devfile from that same github repo is linked instead, the theia editor is still added, but the environment variables and container arguments are not applied

Adding the che-theia.eclipse.org/vscode-extensions attribute to the devfile does not make the behavior the same.

Che version

next (development version)

Steps to reproduce

  1. Create workspace using golang sample repo
    https://<che-host>/#https://github.com/che-samples/golang-example/tree/devfilev2
    
  2. Create a workspace using the devfile from that repo:
    https://<che-host>/https://raw.githubusercontent.com/che-samples/golang-example/devfilev2/devfile.yaml?new
    
  3. Create a workspace using that devfile, but with the project and vscode-extensions attribute present:
    https://<che-host>/#https://gist.githubusercontent.com/amisevsk/ccd62a455c8280f36e21cdeec169a0aa/raw/b17424c111e15bc91acd16a3a5ecd28d6df1135f/golang-sample.devfile.yaml?new
    

The diff in DevWorkspace spec between 1) and 2) is

   components:
-    - attributes:
-        app.kubernetes.io/name: tools
-        che-theia.eclipse.org/vscode-extensions:
-          - https://github.com/golang/vscode-go/releases/download/v0.23.0/go-0.23.0.vsix
-      container:
-        args:
-          - sh
-          - -c
-          - ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
+    - container:
         endpoints:
           - exposure: public
             name: 8080-tcp
             protocol: http
             targetPort: 8080
         env:
           - name: GOPATH
             value: /projects:/home/user/go
           - name: GOCACHE
             value: /tmp/.cache
-          - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
-            value: /remote-endpoint/plugin-remote-endpoint
-          - name: THEIA_PLUGINS
-            value: local-dir:///plugins/sidecars/tools
           - name: CHE_DASHBOARD_URL
             value: https://eclipse-che.apps.ci-ln-dpbh8f2-72292.origin-ci-int-gce.dev.rhcloud.com
           - name: CHE_PLUGIN_REGISTRY_URL
             value: https://eclipse-che.apps.ci-ln-dpbh8f2-72292.origin-ci-int-gce.dev.rhcloud.com/plugin-registry/v3
           - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
             value: http://plugin-registry.eclipse-che.svc:8080/v3
         image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
         memoryLimit: 2Gi
         mountSources: true
         sourceMapping: /projects
-        volumeMounts:
-          - name: remote-endpoint
-            path: /remote-endpoint
-          - name: plugins
-            path: /plugins

The diff between 1) and 3) is the same, except the attributes are present (including app.kubernetes.io/name, which is added)

Expected behavior

Devfiles should be processed in roughly the same way regardless of whether they're from a github repo or a plain devfile.

Runtime

OpenShift

Screenshots

No response

Installation method

chectl/next

Environment

Linux

Eclipse Che Logs

No response

Additional context

No response

@amisevsk amisevsk added kind/bug Outline of a bug - must adhere to the bug report template. area/dashboard area/factory/dashboard Issues related to factories frontend (che user dashboard side) labels May 30, 2022
@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 30, 2022
@benoitf
Copy link
Contributor

benoitf commented May 30, 2022

AFAUIK it's because in first case Factory is able to check .che / .vscode folders / files while in the gist case there is no context, so it takes only information from the devfile.
This is also why all samples are urls+context and not only a devfile content

@amisevsk
Copy link
Contributor Author

The only additional context I can find in the https://github.com/che-samples/golang-example/tree/devfilev2 repo is

  • .vscode/extensions.json:
    {
      // See https://go.microsoft.com/fwlink/?LinkId=827846
      // for the documentation about the extensions.json format
      "recommendations": [
        "golang.go"
      ]
    }
  • .vscode/launch.json:
    {
      // Use IntelliSense to learn about possible attributes.
      // Hover to view descriptions of existing attributes.
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Debug current file",
          "type": "go",
          "request": "launch",
          "mode": "auto",
          "program": "${fileDirname}"
        }
      ]
    }

As far as I know, the extensions.json is only used to decide which plugins to install (hence the che-theia.eclipse.org/vscode-extensions attribute), and launch.json is only used while the editor is running.

Is there a good reason to not add the required fields in the gist case? I don't see anything in the repo itself to tell Che that it's safe to modify that container. This approach makes it impossible to use a devfile that's not part of a repository.

@benoitf
Copy link
Contributor

benoitf commented May 31, 2022

You can inline .vscode/extensions.json in the devfile.yaml

@dkwon17 dkwon17 added 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 31, 2022
@dkwon17
Copy link
Contributor

dkwon17 commented May 31, 2022

I've set this issue to P2 since I don't think it has a major impact to users today, but please feel free to change it

@che-bot
Copy link
Contributor

che-bot commented Nov 27, 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 added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 27, 2022
@che-bot che-bot closed this as completed Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard area/factory/dashboard Issues related to factories frontend (che user dashboard side) 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/P2 Has a minor but important impact to the usage or development of the system.
Projects
None yet
Development

No branches or pull requests

4 participants