ComponentsDefining environment variables

Components

Defining environment variables

Environment variables are supported by the following component types: container, plugin, kubernetes, openshift. If the component has multiple containers, environment variables will be provisioned for each container.

  1. Specify environment variables for container components

    Specify environment variables for a container components

    devfile.yaml
    schemaVersion: 2.0.0
    metadata:
      name: MyDevfile
    components:
      - name: go
        container:
          image: golang
          memoryLimit: 512Mi
          mountSources: true
          command: ['sleep', 'infinity']
          env:
            - name: GOPATH
              value: $(PROJECTS_ROOT)/go
    
  2. Specify environment variables for plugin components

    Specify environment variables for plugin components

    devfile.yaml
    schemaVersion: 2.0.0
    metadata:
      name: MyDevfile
      - name: theia-editor
        plugin:
          id: eclipse/che-theia/next
          memoryLimit: 2Gi
          env:
          - name: HOME
            value: $(CHE_PROJECTS_ROOT)
    

    Note!

    • The variable expansion works between the environment variables, and it uses the Kubernetes convention for the variable references.

    • The predefined variables are available for use in custom definitions.

Additional resources