This section describes how to manually convert an old Che 6.x workspace configuration to a Che 7.3 devfile. The following are the benefits of using a Che 7.3 devfile:

  • Using a portable file that works with any installation of Che; nothing needs to be changed on the server to start a workspace.

  • Configuration can be stored in project repository and automatically used by Che to start a workspace. To start a workspace, specify a devfile using the following format: <che-instance-domain>/f?url=path, for example:

https://che.openshift.io/f?url=https://raw.githubusercontent.com/redhat-developer/devfile/master/getting-started/vertx/devfile.yaml

This creates and starts a new workspace based on the devfile defined in the URL attribute. * A human-readable YAML format for all content.

Below, there is a comparison of a Che 6.x workspace configuration and a Che 7.3 devfile. Both are Java Vert.x stacks with a default project and default settings:

Che 6.x configuration file
{
  "defaultEnv": "default",
  "environments": {
    "default": {
      "machines": {
        "dev-machine": {
          "attributes": {
            "memoryLimitBytes": "2147483648"
          },
          "servers": {
            "8080/tcp": {
              "attributes": {},
              "port": "8080",
              "protocol": "http"
            }
          },
          "volumes": {},
          "installers": [
            "com.redhat.oc-login",
            "com.redhat.bayesian.lsp",
            "org.eclipse.che.ls.java",
            "org.eclipse.che.ws-agent",
            "org.eclipse.che.exec",
            "org.eclipse.che.terminal"
          ],
          "env": {}
        }
      },
      "recipe": {
        "type": "dockerimage",
        "content": "quay.io/openshiftio/che-vertx"
      }
    }
  },
  "projects": [
    {
      "links": [],
      "name": "vertx-http-booster",
      "attributes": {
        "language": [
          "java"
        ]
      },
      "type": "maven",
      "source": {
        "location": "https://github.com/openshiftio-vertx-boosters/vertx-http-booster",
        "type": "git",
        "parameters": {}
      },
      "path": "/vertx-http-booster",
      "description": "HTTP Vert.x Booster",
      "problems": [],
      "mixins": []
    }
  ],
  "name": "wksp-jhwp",
  "commands": [
    {
      "commandLine": "scl enable rh-maven33 'mvn compile vertx:debug -f ${current.project.path} -Dvertx.disableDnsResolver=true'",
      "name": "debug",
      "attributes": {
        "goal": "Debug",
        "previewUrl": "${server.8080/tcp}"
      },
      "type": "custom"
    },
    {
      "commandLine": "scl enable rh-maven33 'mvn compile vertx:run -f ${current.project.path} -Dvertx.disableDnsResolver=true'",
      "name": "run",
      "attributes": {
        "goal": "Run",
        "previewUrl": "${server.8080/tcp}"
      },
      "type": "custom"
    },
    {
      "commandLine": "scl enable rh-maven33 'mvn clean install -f ${current.project.path}'",
      "name": "build",
      "attributes": {
        "goal": "Build",
        "previewUrl": ""
      },
      "type": "mvn"
    },
    {
      "commandLine": "mvn -Duser.home=${HOME} -f ${CHE_PROJECTS_ROOT}/vertx-http-booster clean package",
      "name": "vertx-http-booster:build",
      "attributes": {
        "goal": "Build",
        "previewUrl": ""
      },
      "type": "mvn"
    },
    {
      "commandLine": "mvn -Duser.home=${HOME} -f ${CHE_PROJECTS_ROOT}/vertx-http-booster vertx:run",
      "name": "vertx-http-booster:run",
      "attributes": {
        "goal": "Run",
        "previewUrl": "${server.8080/tcp}"
      },
      "type": "mvn"
    }
  ],
  "links": []
}
Che 7.3 devfile
metadata:
  name: testing-workspace
projects:
  - name: java-web-vertx
    source:
      location: 'https://github.com/che-samples/web-java-vertx'
      type: git
components:
  - id: redhat/java/latest
    type: chePlugin
  - mountSources: true
    endpoints:
      - name: 8080/tcp
        port: 8080
    memoryLimit: 512Mi
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    alias: maven
    image: 'quay.io/eclipse/che-java8-maven:nightly'
apiVersion: 1.0.0
commands:
  - name: maven build
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/java-web-vertx'
        type: exec
        command: 'mvn -Duser.home=${HOME} clean install'
        component: maven
  - name: run app
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/java-web-vertx'
        type: exec
        command: >
          JDBC_URL=jdbc:h2:/tmp/db \

          java -jar -Xdebug
          -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 \

          ./target/*fat.jar
        component: maven
  - name: Debug remote java application
    actions:
      - referenceContent: |
          {
          "version": "0.2.0",
          "configurations": [
            {
              "type": "java",
              "name": "Debug (Attach) - Remote",
              "request": "attach",
              "hostName": "localhost",
              "port": 5005
            }]
          }
        type: vscode-launch

Converting a Che 6.x workspace to a basic Che 7.3 devfile

This section describes how to convert a Che 6.x workspace to a Che 7.3 devfile. The result is a basic Che 7.3 devfile that can be used for further workspace creation.

Prerequisites
Procedure

To convert a Che 6.x workspace to a Che 7.3 devfile:

  1. Open an old Che 6.x configuration file to identify which Che 6.x stack is used in the workspace. Below, there is a detailed guide for Accessing a Che 6.x workspace configuration.

  2. Create a new workspace from the Che 7.3 devfile that corresponds to the Che 6.x stack.

    Table 1. Che 7.3 devfile corresponding to the respective Che 6.x stacks.
    Che 6.x stacks Che 7.3 devfile

    Apache Camel based projects,
    Apache Camel based projects on Che 7.3

    Apache Camel based on Spring Boot

    .NET,
    .NET Core with Che-Theia IDE

    .NET Core

    Go,
    CentOS Go,
    Go with Che-Theia IDE

    Go

    Java Gradle

    Java Gradle

    Blank,
    Java,
    Java-MySQL,
    Eclipse Che,
    Java CentOS

    Java Maven

    Node,
    CentOS nodejs

    NodeJS Express Web Application

    Python,
    Python with Che-Theia IDE

    Python

    Eclipse Vert.x

    Java Vert.x

    PHP

    PHP Simple

    Spring Boot

    Java Spring Boot

    1. By default, the example project is added to the workspace. To remove the default project, click the Remove button:

      remove default project
    2. To import a custom project that was used in Che 6.x workspace, click the Add or Import Project and select Git or GitHub option:

      add custom project
    3. Various commands can be added to devfiles of imported projects, for example, run, build, and test. The commands are then accessible from the IDE when a workspace is started. Custom commands and other devfile components can be added in the Devfile configuration.

    4. Click the Create & Proceed Editing button.

      create and edit

      Select the Devfile tab to update the configuration. Machine servers in Che 6.x workspaces can be specified as components endpoints in a Devfile and Che 6.x installers as components of type chePlugin. See the Devfile specification for the detailed information about the supported properties and attributes.

      update devfile configuration
    5. Once the Devfile configuration is completed, click the Open button to start a newly created Che 7.3 workspace.

Accessing a Che 6.x workspace configuration

Che 6.x workspace configuration is not supported in Che 7.3 but can be accessed for further conversion to a devfile.

Prerequisites
Procedure

To access the Che 6.x workspace configuration:

  1. In the Dashboard, click the Workspaces menu to open the workspaces list and locate the workspace to migrate to Che 7.3.

  2. In the Actions column, click the Configure workspace icon. The raw workspace configuration is available under the Config tab.

    configure workspace button
    config workspace code
Tags: