Uploaded image for project: 'Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) '
  1. Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces)
  2. CRW-2492

devfile v2 commands with variable "PROJECT_ROOT" don't work after conversion to devfile v1

    XMLWordPrintable

Details

    • False
    • False
    • Workaround Exists
    • Hide

      Change variable names in resulted devfile from "${PROJECTS_ROOT}" to "${CHE_PROJECTS_ROOT}".

      Show
      Change variable names in resulted devfile from " ${PROJECTS_ROOT} " to " ${CHE_PROJECTS_ROOT} ".

    Description

      Java spring petclinic workspace of devfile v1 failed to build after conversion from devfile v2 [1] in CRW 2.13.0.RC-11-17 [2] because of error:

      sh: line 0: cd: /java-spring-petclinic: No such file or directory
      

      CRW with DevWorkspace disabled is using "CHE_PROJECTS_ROOT" variable instead of "PROJECTS_ROOT".

      converted devfile v1
      apiVersion: 1.0.0
      metadata:
        name: spring-petclinicr2hh
      projects:
        - name: java-spring-petclinic
          source:
            location: 'https://github.com/che-samples/java-spring-petclinic.git'
            startPoint: devfilev2
            type: git
      components:
        - endpoints:
            - name: debug
              port: 5005
            - name: 8080-tcp
              port: 8080
          memoryLimit: 3Gi
          type: dockerimage
          alias: tools
          image: 'quay.io/devfile/universal-developer-image:ubi8-d433ed6'
        - endpoints:
            - name: db
              port: 3306
          memoryLimit: 300Mi
          type: dockerimage
          alias: mysql
          image: 'quay.io/eclipse/che--centos--mysql-57-centos7:latest-e08ee4d43b7356607685b69bde6335e27cf20c020f345b6c6c59400183882764'
          env:
            - value: petclinic
              name: MYSQL_USER
            - value: petclinic
              name: MYSQL_PASSWORD
            - value: petclinic
              name: MYSQL_DATABASE
            - value: '$(echo ${0})\\$'
              name: PS1
        - id: redhat/vscode-yaml/latest
          type: chePlugin
        - id: redhat/vscode-xml/latest
          type: chePlugin
        - id: redhat/java/latest
          type: chePlugin
      commands:
        - name: prepare-database
          actions:
            - workdir: '${PROJECTS_ROOT}/java-spring-petclinic'
              type: exec
              command: |
                /opt/rh/rh-mysql57/root/usr/bin/mysql -u root < ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/user.sql && \
                /opt/rh/rh-mysql57/root/usr/bin/mysql -u root petclinic < ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/schema.sql && \
                /opt/rh/rh-mysql57/root/usr/bin/mysql -u root petclinic < ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/data.sql && \
                echo -e "\e[32mDone.\e[0m Database petclinic was configured"
              component: mysql
        - name: build
          actions:
            - workdir: '${PROJECTS_ROOT}/java-spring-petclinic'
              type: exec
              command: mvn clean install
              component: tools
        - name: run-with-hsqldb
          actions:
            - workdir: '${PROJECTS_ROOT}/java-spring-petclinic'
              type: exec
              command: java -jar target/*.jar
              component: tools
        - name: run-with-mysql
          actions:
            - workdir: '${PROJECTS_ROOT}/java-spring-petclinic'
              type: exec
              command: |
                java -jar -Dspring-boot.run.profiles=mysql \
                -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 \
                target/*.jar
              component: tools
        - name: run-debug
          actions:
            - workdir: '${PROJECTS_ROOT}/java-spring-petclinic'
              type: exec
              command: 'java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 target/*.jar'
              component: tools
      

      [1] https://github.com/che-samples/java-spring-petclinic/tree/devfilev2
      [2] https://codeready-crw-crwctl.apps.ocp49.crw-qe.com/f?url=https://github.com/che-samples/java-spring-petclinic/tree/devfilev2

      Attachments

        Issue Links

          Activity

            People

              fbenoit@redhat.com Florent Benoit
              dnochevn Dmytro Nochevnov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: