Including the plug-in binaries in the registry image

The plug-in registry only hosts Che plug-in metadata. The binaries are usually referred through a link in the meta.yaml file. In some cases, such as in offline environments, it may be necessary to make the binaries available inside the registry image.

This section describes how to modify a plug-in meta.yaml file to point to a local file inside the container and build a new registry that contains the modified plug-in meta.yaml file and the plug-in binary file. In the following example, the Java plug-in that refers to two remote VS Code extensions binaries is considered.

Prerequisites
  • An instance of Che is available.

  • The oc tool is available.

Procedure
  1. Clone the che-plugin-registry repository:

    $ git clone https://github.com/eclipse/che-plugin-registry
    $ cd che-plugin-registry
  2. Identify the binaries you wish to host locally in the custom plug-in registry.

    The meta.yaml file includes the extension section, which defines the URLs of required extensions for the plug-in. For example, the redhat/java11/0.63.0 plug-in lists the following two extensions:

    meta.yaml
    extensions:
      - https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix
      - https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.63.0-2222.vsix

    Download these two extensions and host them in the plug-in-registry. When using the redhat/java11/0.63.0 plug-in, the binary will be fetched from the custom plug-in-registry server. Set the following environment variables to help with the subsequent commands:

    ORG=redhat
    NAME=java11
    CHE_PLUGIN_VERSION=0.63.0
    VSCODE_JAVA_DEBUG_VERSION=0.26.0
    VSCODE_JAVA_DEBUG_URL="https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix"
    VSCODE_JAVA_DEBUG_BINARY_NAME="vscode-java-debug-0.26.0.vsix"
    JAVA_LS_VERSION=0.63.0-2222
    JAVA_LS_URL="https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.63.0-2222.vsix"
    JAVA_LS_BINARY_NAME="java-0.63.0-2222.vsix"
    OLD_JAVA_DEBUG_META_YAML_URL="https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix"
    OLD_JAVA_LS_META_YAML_URL="https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.63.0-2222.vsix"
  3. Download the binaries locally:

    $ curl -sSL -o ./v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/${VSCODE_JAVA_DEBUG_BINARY_NAME} \
      ${VSCODE_JAVA_DEBUG_URL}
    $ curl -sSL -o ./v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/${JAVA_LS_BINARY_NAME} \
      ${JAVA_LS_URL}
  4. Get the plug-in registry URL:

    $ kubectl get route plugin-registry -o jsonpath='{.spec.host}' -n ${CHE_NAMESPACE}

    Save this value in a variable called PLUGIN_REGISTRY_URL.

  5. Update the URLs in the meta.yaml file to point to the VS Code extension binaries that are saved in the registry container:

    By default, Che is deployed with TLS enabled. For installations that do not use TLS, use http:// in the NEW_JAVA_DEBUG_URL and NEW_JAVA_LS_URL variables.
    NEW_JAVA_DEBUG_URL=https://${PLUGIN_REGISTRY_URL}/v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/${VSCODE_JAVA_DEBUG_BINARY_NAME}
    NEW_JAVA_LS_URL=https://${PLUGIN_REGISTRY_URL}/v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/${JAVA_LS_BINARY_NAME}
    $ sed -i -e "s#${OLD_JAVA_DEBUG_META_YAML_URL}#${NEW_JAVA_DEBUG_URL}#g" \
      ./v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/meta.yaml
    $ sed -i -e "s#${OLD_JAVA_LS_META_YAML_URL}#${NEW_JAVA_LS_URL}#g" \
      ./v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/meta.yaml
  6. Confirm that the meta.yaml has the correctly substituted the URLs:

    $ cat ./v3/plugins/${ORG}/${NAME}/${CHE_PLUGIN_VERSION}/meta.yaml
    meta.yaml
    extensions:
      - https://plugin-registry-che.apps-crc.testing/v3/plugins/redhat/java11/0.63.0/vscode-java-debug-0.26.0.vsix
      - https://plugin-registry-che.apps-crc.testing/v3/plugins/redhat/java11/0.63.0/java-0.63.0-2222.vsix
  7. Build and deploy the plug-in registry using the instructions in the Building and running a custom registry image section.