Creating a new workspace from the dashboard

This procedure describes how to create and edit a new Che devfile using the Dashboard.

Prerequisites
  • A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che 'quick-starts'.

Procedure

To edit the devfile:

  1. In the Workspaces window, click the Add Workspace button. The Custom Workspace page should be opened.

  2. Scroll down to the Devfile section. In the Devfile editor, add necessary changes.

    Devfile editor with the minimal devfile
    Example: add a project

    To add a project into the workspace, add or edit the following section:

    projects:
      - name: che
        source:
          type: git
          location: 'https://github.com/eclipse/che.git'

Adding projects to your workspace

Prerequisites
Procedure

To add a project to your workspace:

  1. Navigate to Workspaces page and click the workspace you want to update.

    Here you have two ways to add a project to your workspace:

  2. From the Projects tab.

    1. Open the Projects tab, and then click the Add Project button.

    2. Choose if you want to import the project by Git URL or from your GitHub account.

      Add Git Project
  3. From the Devfile tab.

    1. Open the Devfile tab.

    2. In the Devfile editor, add projects section with desired project.

      Edit Devfile Content
      Example: add a project

      To add a project into the workspace, add or edit the following section:

      projects:
        - name: che
          source:
            type: git
            location: 'https://github.com/eclipse/che.git'
  4. Once the project is added, click Save button to save this workspace configuration, or click Apply button to apply changes to the running workspace.

    Save Workspace Configuration

Configuring the workspace and adding tools

Adding plug-ins

Prerequisites
Procedure

To add plug-ins to your workspace:

  1. Click the Plugins tab.

  2. Enable the plug-in that you want to add and click the Save button.

Defining the workspace editor

Prerequisites
Procedure

To define the editor to use with the workspace:

  1. Click the Editors tab.

    The recommended editor for Che 7.15 is Che-Theia.
  2. Enable the editor to add and click the Save button.

  3. Click the Devfile tab to view the changes.

    workspace devfile

Defining specific container images

Procedure

To add a new container image:

  1. In the Devfile tab, add the following section under the components property:

    components:
      - mountSources: true
         command:
           - sleep
         args:
           - infinity
         memoryLimit: 1Gi
         alias: maven3-jdk11
         type: dockerimage
         endpoints:
           - name: 8080/tcp
             port: 8080
         volumes:
           - name: projects
             containerPath: /projects
         image: 'maven:3.6.0-jdk-11'
  2. When using type: kubernetes or type: openshift, you must:

    • Use separate recipe files.

      To use separate recipe files, you may specify relative or absolute paths. For example:

      ...
          type: kubernetes
          reference: deploy_k8s.yaml
      ...
      ...
          type: openshift
          reference: deploy_openshift.yaml
      ...
  3. Add a Che 7.14 recipe content to the Che 7.15 devfile as referenceContent:

    component as a referenceContent
    1. Set the type from the original Che 7.14 configuration. The following is an example of the resulting file:

        type: kubernetes
        referenceContent: |
          apiVersion: v1
          kind: Pod
          metadata:
           name: ws
          spec:
           containers:
            -
             image: 'rhche/centos_jdk8:latest'
             name: dev
             resources:
             limits:
               memory: 512Mi
  4. Copy the required fields from the old workspace (image, volumes, endpoints). For example:

    workspace devfile che 7
  5. Change the memoryLimit and alias variables, if needed. Here, the field alias is used to set a name for the component. It is generated automatically from the image field, if not set.

      image: 'maven:3.6.0-jdk-11'
      alias: maven3-jdk11
  6. Change the memoryLimit, memoryRequest, or both fields to specify the RAM required for the component.

      alias: maven3-jdk11
      memoryLimit: 256M
      memoryRequest: 128M
  7. Repeat the steps to add additional container images.

Adding commands to your workspace

The following is a comparison between workspace configuration commands in Che 7.14 (Figure 1) and Che 7.15 (Figure 2):

workspace devfile
Figure 1. An example of the Workspace configuration commands in Che 7.15
Procedure

To define commands to your workspace, edit the workspace devfile:

  1. Add (or replace) the commands section with the first command. Change the name and the command fields from the original workspace configuration (see the preceding equivalence table).

    commands:
      - name: build
        actions:
          - type: exec
            command: mvn clean install
  2. Copy the following YAML code into the commands section to add a new command. Change the name and the command fields from the original workspace configuration (see the preceding equivalence table).

      - name: build and run
        actions:
          - type: exec
            command: mvn clean install && java -jar
  3. Optionally, add the component field into actions. This indicates the component alias where the command will be performed.

  4. Repeat step 2 to add more commands to the devfile.

  5. Click the Devfile tab to view the changes.

    workspace devfile changes
  6. Save changes and start the new Che 7.15 workspace.

    save and start the new che workspace
Tags: