che icon indicating copy to clipboard operation
che copied to clipboard

devfile: che plugins (vscode) and che editors should accept volumes

Open sunix opened this issue 7 years ago • 12 comments

Description

In some case, we would like to share a volume with a che plugin

for instance with this devfile, where we want to share the same volume for the quay-io-quarku component and the java-ls component but the java-ls does not accept volumes:

specVersion: 0.0.1
name: quarkus-che-demo
projects:
  - source:
      type: git
      location: 'https://github.com/sunix/che-quarkus-demo'
    name: che-quarkus-demo
components:
  - alias: quay-io-quarkus-cent
    type: dockerimage
    image: quay.io/quarkus/centos-quarkus-maven
    memoryLimit: 512M
    mountSources: true
    command:
      - tail
    args:
      - '-f'
      - /dev/null
    volumes:
      - name: mavenrepo
        containerPath: /root/.m2
  - type: chePlugin
    alias: java-ls
    id: redhat/java/0.43.0
    memoryLimit: 2Gi
    volumes:
      - name: mavenrepo
        containerPath: /root/.m2
  - type: cheEditor
    alias: theia-editor
    id: eclipse/che-theia/next
  -
    alias: git-devtools
    type: dockerimage
    image: sunix/git-devtools
    mountSources: true
    memoryLimit: 256M
    command:
      - tail
    args:
      - '-f'
      - /dev/null
commands:
  - name: 'mvn compile quarkus:dev'
    actions:
      - type: exec
        command: "kill -9 $(ps aux | grep 'java' | awk '{print $2}'); mvn compile quarkus:dev"
        component: quay-io-quarkus-cent
        workdir: /projects/che-quarkus-demo/sunix-quarkus-demo

But:

workspace:start --devfile=quarkus.devfile
  ✔ Retrieving Che Server URL...http://che-che.192.168.39.14.nip.io
  ✔ Verify if Che server is running
  ✖ Create workspace from Devfile quarkus.devfile
    → E_BAD_DEVFILE_FORMAT - Message: Devfile schema validation failed. Error: (/components/1/volumes):The object must not have a property whose name is "volumes".
Error: E_BAD_DEVFILE_FORMAT - Message: Devfile schema validation failed. Error: (/components/1/volumes):The object must not have a property whose name is "volumes".
    at CheHelper.<anonymous> (/projects/chectl/src/api/che.ts:230:15)
    at Generator.throw (<anonymous>)
    at rejected (/projects/chectl/src/api/che.ts:16:65)
/projects/chectl # 

OS and version:
Minikube/chectl with helm single user.

sunix avatar May 12 '19 20:05 sunix

CC @l0rd @sleshchenko @metlos I'm not sure about this issue. Should be a ChePlugin busines to provide such volume. WDYT?

skabashnyuk avatar May 15 '19 07:05 skabashnyuk

I think it makes sense to let users add volumes for plugin as well. There is no need to do that for GA though.

l0rd avatar May 26 '19 21:05 l0rd

While in general I agree this is a good idea, in this concrete example it seems quite dangerous to me, because local maven repo is not "thread safe" and 2 parallel builds can corrupt it - https://issues.apache.org/jira/browse/MNG-2802. Not sure if we (or the user) can control the access to the repository done by the java plugin.

metlos avatar Jul 03 '19 09:07 metlos

@metlos What is the difference with a classic use case?

  • User runs maven from command line and
  • at the same time the classic desktop Eclipse IDE is invoking maven

sunix avatar Jul 03 '19 11:07 sunix

local maven repo is not "thread safe" and 2 parallel builds can corrupt it -

Yes, but it's no worse than running an Eclipse instance and maven cli in parallel.

tsmaeder avatar Feb 17 '20 13:02 tsmaeder

I too need this feature of sharing files and folders between cheEditor and chePlugin and possibly other containers. Otherwise, I end up with copying several GB of files to both the containers.

svkr2k avatar Mar 03 '20 03:03 svkr2k

@lord @davidfestal I have a question regarding this feature. Do you think it makes sense to add specific ephemeral attribute into single volume declaration, while we have an global persistVolumes attribute of devfile which affects all PV-s of all components as far as i understood. It may produce some inconsistence if set all to true but mark some individual as ephemeral, but at the same time it will allow more flexibility to manage PV-s. WDYT? cc @skabashnyuk @metlos @sleshchenko

mshaposhnik avatar Mar 17 '20 11:03 mshaposhnik

@mshaposhnik what would you use such a feature for?

tsmaeder avatar Mar 17 '20 13:03 tsmaeder

@tsmaeder which one? ephemeral per volume?

mshaposhnik avatar Mar 17 '20 14:03 mshaposhnik

yes.

tsmaeder avatar Mar 17 '20 15:03 tsmaeder

@lord @davidfestal I have a question regarding this feature. Do you think it makes sense to add specific ephemeral attribute into single volume declaration, while we have an global persistVolumes attribute of devfile which affects all PV-s of all components as far as i understood. It may produce some inconsistence if set all to true but mark some individual as ephemeral, but at the same time it will allow more flexibility to manage PV-s. WDYT? cc @skabashnyuk @metlos @sleshchenko

@mshaposhnik I am not sure that we need ephemeral at single plugin level and it would be inconsistent with dockerimage.

l0rd avatar Mar 18 '20 01:03 l0rd

Happy using!

mshaposhnik avatar Mar 23 '20 15:03 mshaposhnik