Che: Improve UX during ${current.project.path} macros usage

Created on 27 Jun 2019  路  3Comments  路  Source: eclipse/che

Description

I hope that there is much work to fix it, so I decided to describe several improvements in the same issue:

  1. Improve UX when user tries to run a command which has ${current.project.path} macros and there is no selected project.
    Actual: Three error messages: Can not resolve current.project.path ..., and Tasks is failed, sh: 1: Bad substitution.
    First time I got this:
    Screenshot_20190627_114007
    And then
    Screenshot_20190627_113345

Expected: Error message: please select a project before executing a command to make it possible to resolve the current project path. In my case there was only one project, so maybe it may be chosen automatically.

  1. Make it possible to use ${current.project.path} macros in workingDir field of Devfile. Currently, it just does not work:
    Screenshot_20190627_114022

I used the following Java Maven Devfile for testing:


Devfile.yaml

---
apiVersion: 1.0.0
metadata:
  name: java-maven
projects:
  -
    name: console-java-simple
    source:
      type: git
      location: "https://github.com/che-samples/console-java-simple.git"
components:
  -
    type: chePlugin
    id: redhat/java/latest
  -
    type: dockerimage
    alias: maven
    image: maven:3.6.0-jdk-11
    command: ['sleep']
    args: ['infinity']
    env:
      - name: MAVEN_CONFIG
        value: /home/user/.m2
      - name: MAVEN_OPTS
        value: "-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
          -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom
          -Duser.home=/home/user"
      - name: JAVA_OPTS
        value: "-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
          -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom"
      - name: JAVA_TOOL_OPTIONS
        value: "-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
          -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
          -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom"
      - name: PS1
        value: $(echo ${0})\\$
      - name: HOME
        value: /home/user
    memoryLimit: 512Mi
    endpoints:
      - name: '8080/tcp'
        port: 8080
    mountSources: true
    volumes:
      - name: m2
        containerPath: /home/user/.m2
commands:
  -
    name: maven build
    actions:
      -
        type: exec
        component: maven
        command: "mvn -Duser.home=${HOME} clean install"
        workdir: ${current.project.path}
  -
    name: maven build and run
    actions:
      -
        type: exec
        component: maven
        command: "cd ${current.project.path} && mvn -Duser.home=${HOME} clean install && java -jar ./target/*.jar"

kintask teaplugins

Most helpful comment

in the Theia upstream exist similar macros called workspaceFolder probably we can reuse it, and deprecate current.project.path because we don't have project notation anymore.
Ideas ?

All 3 comments

@evidolob @vparfonov Please assign right team, because I'm not sure who should work on it.

From my experience (having used che6 a lot), the problem with current.project.path is that it is very hard to know what this is actually is .... the project selected in the project explorer ? the current active editor ? the folder where you are in the current terminal ?
Also, we don't really have 'projects'. What if you have a Maven project stored in a subfolder of the git root folder. What is your project ?
I know it is solving issues with samples, but in real use case it doesn't really work.

in the Theia upstream exist similar macros called workspaceFolder probably we can reuse it, and deprecate current.project.path because we don't have project notation anymore.
Ideas ?

Was this page helpful?
0 / 5 - 0 ratings