Chapter 6. Managing IDE extensions
IDEs use extensions or plugins to extend their functionality, and the mechanism for managing extensions differs between IDEs.
6.1. Extensions for Microsoft Visual Studio Code - Open Source Copy linkLink copied to clipboard!
To manage extensions, OpenShift Dev Spaces uses one of the following Open VSX registry instances:
-
The embedded instance of the Open VSX registry that runs in the pod of OpenShift Dev Spaces to support air-gapped, offline, and proxy-restricted environments. The embedded Open VSX registry contains only a subset of the extensions published on open-vsx.org. You can customize this subset using a workspace or using a Linux operating system.
plugin-registry - The public open-vsx.org registry that is accessed over the internet.
- A standalone Open VSX registry instance that is deployed on a network accessible from OpenShift Dev Spaces workspace pods.
The default is the embedded instance of the Open VSX registry.
6.1.1. Selecting an Open VSX registry instance Copy linkLink copied to clipboard!
The default is the embedded instance of the Open VSX registry.
If the default Open VSX registry instance does not meet your requirements, you can select one of the following instances:
-
The Open VSX registry instance at that requires access to the internet.
https://open-vsx.org - A standalone Open VSX registry instance that is deployed on a network accessible from OpenShift Dev Spaces workspace pods.
Prerequisites
- You have administrator access to the cluster where OpenShift Dev Spaces is deployed.
-
You have the CLI tool installed if you are using the command line.
oc
Procedure
- Log in to the cluster as an administrator.
Edit the
custom resource to update theCheClustervalue:openVSXURLspec: components: pluginRegistry: openVSXURL: "<url_of_an_open_vsx_registry_instance>"1 - 1
- For example:
openVSXURL: "https://open-vsx.org".
- Do not use https://open-vsx.org in an air-gapped environment or an environment that is isolated from the internet. To reduce the risk of malware infections and unauthorized access to your code, use the embedded or a self-hosted Open VSX registry with a curated set of extensions.
-
To select the embedded Open VSX registry instance in the pod, use
plugin-registry. You can customize the list of included extensions using a workspace or using a Linux operating system.openVSXURL: '' -
You can point to the URL of a standalone Open VSX registry instance if the URL is accessible from within the organization’s cluster and not blocked by a proxy.
openVSXURL
Verification
-
Confirm that the pod has restarted.
plugin-registry - Open a workspace and verify that extensions are available from the selected registry instance in the Extensions view.
6.1.2. Adding or removing extensions by using a OpenShift Dev Spaces workspace Copy linkLink copied to clipboard!
You can add or remove extensions in the embedded Open VSX registry instance directly within a OpenShift Dev Spaces workspace to create a custom build for your organization.
The embedded plugin registry is deprecated. Setting up an internal, on-premises Open VSX registry provides full control over the extension lifecycle, enables offline use, and improves compliance. Refer to the Section 6.2, “Running Open VSX On-Premises” procedure for detailed setup instructions.
Prerequisites
- You are logged in to your OpenShift Dev Spaces instance as an administrator.
- You have started a workspace using the plugin registry repository.
- You have created a Red Hat Registry Service Account and have the username and token available.
-
For IBM Power () and IBM Z (
ppc64le) architectures, you must build the custom plugin registry locally on the corresponding hardware.s390x - (Optional) You can rebuild the container based on the latest tag or SHA to get the latest security fixes after a OpenShift Dev Spaces update.
Procedure
Identify the publisher and extension name for each extension you want to add:
- Find the extension on the Open VSX registry website.
- Copy the URL of the extension’s listing page.
Extract the
and<publisher>from the URL:<name>https://open-vsx.org/extension/<publisher>/<name>TipIf the extension is only available from Microsoft Visual Studio Marketplace, but not Open VSX, you can ask the extension publisher to publish it on open-vsx.org according to these instructions, potentially using this GitHub action.
If the extension publisher is unavailable or unwilling to publish the extension to open-vsx.org, and if there is no Open VSX equivalent of the extension, consider reporting an issue to the Open VSX team.
-
Open the file in the workspace.
openvsx-sync.json Add or remove extensions using the following JSON syntax:
{ "id": "<publisher>.<name>", "version": "<extension_version>" }TipIf you have a closed-source extension or an extension developed only for internal use in your organization, you can add the extension directly from a
file by using a URL accessible to your custom plugin registry container:.vsix{ "id": "<publisher>.<name>", "download": "<url_to_download_vsix_file>", "version": "<extension_version>" }Read the Terms of Use for the Microsoft Visual Studio Marketplace before using its resources.
Log in to the Red Hat registry:
-
Navigate to Terminal
Run Task… devfile. - Run the 1. Login to registry.redhat.io task.
- Enter your Red Hat Registry Service Account credentials when prompted.
-
Navigate to Terminal
Build and publish the custom plugin registry:
-
Navigate to Terminal
Run Task… devfile. Run the 2. Build and Publish a Custom Plugin Registry task.
NoteVerify that the
in theCHE_CODE_VERSIONfile matches the version of the editor currently used with OpenShift Dev Spaces. Update it if necessary.build-config.json
-
Navigate to Terminal
Configure OpenShift Dev Spaces to use the custom plugin registry:
-
Navigate to Terminal
Run Task… devfile. - Run the 3. Configure Che to use the Custom Plugin Registry task.
-
Navigate to Terminal
Verification
-
Check that the pod has restarted and is running.
plugin-registry - Restart your workspace.
- Open the Extensions view in the IDE and verify that your added extensions are available.
Additional resources
6.1.3. Adding or removing extensions by using a Linux operating system Copy linkLink copied to clipboard!
You can build and publish a custom plugin registry using the Linux command line. This results in a custom build of the Open VSX registry that can be used in your organization’s workspaces.
Prerequisites
- Podman is installed.
- Node.js version 18.20.3 or higher is installed.
- You have created a Red Hat Registry Service Account and have the username and token available.
- You have read the Terms of Use for the Microsoft Visual Studio Marketplace before using its resources.
- (Optional) You can rebuild the container based on the latest tag or SHA to get the latest security fixes after a OpenShift Dev Spaces update.
Procedure
Clone the plugin registry repository:
$ git clone https://github.com/redhat-developer/che-plugin-registry.gitChange to the plugin registry directory:
$ cd che-plugin-registryLog in to the Red Hat registry:
$ podman login registry.redhat.ioIdentify the publisher and extension name for each extension you want to add:
- Find the extension on the Open VSX registry website.
- Copy the URL of the extension’s listing page.
Extract the
and<publisher>from the URL:<name>https://open-vsx.org/extension/<publisher>/<name>TipIf the extension is only available from Microsoft Visual Studio Marketplace, but not Open VSX, you can ask the extension publisher to publish it on open-vsx.org according to these instructions, potentially using this GitHub action.
If the extension publisher is unavailable or unwilling to publish the extension to open-vsx.org, and if there is no Open VSX equivalent of the extension, consider reporting an issue to the Open VSX team.
-
Open the file.
openvsx-sync.json Add or remove extensions using the following JSON syntax:
{ "id": "<publisher>.<name>", "version": "<extension_version>" }TipIf you have a closed-source extension or an extension developed only for internal use in your organization, you can add the extension directly from a
file by using a URL accessible to your custom plugin registry container:.vsix{ "id": "<publisher>.<name>", "download": "<url_to_download_vsix_file>", "version": "<extension_version>" }Build the plugin registry container image:
$ ./build.sh -o <username> -r quay.io -t customNoteVerify that the
in theCHE_CODE_VERSIONfile matches the version of the editor currently used with OpenShift Dev Spaces. Update it if necessary.build-config.jsonPush the image to a container registry such as quay.io:
$ podman push quay.io/<username>/plugin_registry:customEdit the
custom resource in your organization’s cluster to point to the image and save the changes:CheClusterspec: components: pluginRegistry: deployment: containers: - image: quay.io/<username>/plugin_registry:custom openVSXURL: ''
Verification
-
Check that the pod has restarted and is running.
plugin-registry - Restart your workspace.
- Open the Extensions view in the IDE and verify that your added extensions are available.
Additional resources
6.2. Running Open VSX On-Premises Copy linkLink copied to clipboard!
Follow the instructions below to deploy and configure an on-premises Eclipse Open VSX extension registry, fully integrated with OpenShift Dev Spaces and OpenShift environments. Choose one of the two setup paths: using a OpenShift Dev Spaces workspace or the OpenShift CLI (
oc
6.2.1. Using OpenShift Dev Spaces instance Copy linkLink copied to clipboard!
Prerequisites
- Be logged in as a cluster administrator.
Procedure
Start a workspace using the Open VSX repository.
Create a workspace by using the following Eclipse Open VSX repository.
WarningThe .devfile.yaml includes an
component that does not support IBM Power (ppc64le) or IBM Z (s390x) architectures. To successfully start the workspace on these architectures, the only option is to remove this component from the devfile. Alternatively, you can refer to Using OpenShift CLI tool documentation, which describes how to run Open VSX separately without starting a workspace.elasticsearchTipThe environment, including all necessary commands, is defined in the
file..devfile.yamlCreate a new OpenShift project for Open VSX.
Run
task in the workspace (2.1. Create Namespace for OpenVSX). A new project with the nameTerminalRun Task… devfile 2.1. Create Namespace for OpenVSX should be created on the cluster.openvsxDeploy Open VSX.
Run
task in the workspace (2.4.1. Deploy Custom OpenVSX). This task will ask to provide the Open VSX server image. EnterTerminalRun Task… devfile 2.4.1. Deploy Custom OpenVSX into the terminal. As a result, in the OpenShift console, you can find theregistry.redhat.io/devspaces/openvsx-rhel9:3.26project with two components:openvsxandPostgreSQL database. Additionally, the Open VSX UI should be accessible through an exposed route in the OpenShift cluster.Open VSX serverTipAll deployment information is described in the
file with some default values such asdeploy/openshift/openvsx-deployment-no-es.yml.OVSX_PAT_BASE64Add Open VSX user with PAT to the database.
Run the
task in the workspace (2.5. Add OpenVSX user with PAT to the DB). The command will ask for the Open VSX username and user PAT. You can just click enter to use the default values.TerminalRun Task… devfile 2.5. Add OpenVSX user with PAT to the DB ImportantThe user PAT must match the decoded value of
specified in the deployment file. IfOVSX_PAT_BASE64has been updated, use the new token’s decoded value as the user PAT.OVSX_PAT_BASE64Configure OpenShift Dev Spaces to use the internal Open VSX.
Run the
task in the workspace (2.6. Configure Che to use the internal Open VSX registry). It applies the patch to theTerminalRun Task… devfile 2.6. Configure Che to use the internal OpenVSX registry custom resource, updating its configuration to use the specified Open VSX URL for the extension registry.CheClusterPublish an extension from a
file..vsixAt the beginning, the Open VSX registry does not provide any extension. Once the
pod is running and in the Ready state, extensions can be published to the registry. Theopenvsx-servercommand publishes an extension to the local Open VSX registry directly from a2.8. Publish a Visual Studio Code Extension from a VSIX filefile. It prompts you to provide the extension’s.vsixname and the path to thenamespacefile..vsixPublish list of extensions.
The
command automates the process of publishing a predefined list of Microsoft Visual Studio Code extensions based on download URLs to the internal Open VSX registry.2.9. Publish list of Visual Studio Code ExtensionsTipThe command reads from the
file, which lists the URLs ofdeploy/openshift/extensions.txtfiles for each extension to be published. To publish your extensions to Open VSX, update the.vsixfile as needed, then run the 2.9. Publish list of Visual Studio Code Extensions task from the workspace:extensions.txt.TerminalRun Task… devfile 2.9. Publish list of Visual Studio Code Extensions Verify that OpenShift Dev Spaces uses internal Open VSX.
Start any workspace and check the available extensions in the Extensions view of the workspace IDE or by opening the
route in the OpenVSX OpenShift project.internal
6.2.2. Using OpenShift CLI (oc) tool Copy linkLink copied to clipboard!
Prerequisites
-
Installed tool.
oc Log in to the OpenShift cluster where the OpenShift Dev Spaces is deployed as a cluster administrator.
Tip$ oc login https://<openshift_dev_spaces_fqdn> --username=<my_user>
Procedure
Create a new OpenShift project for Open VSX.
oc new-project openvsxDeploy Open VSX.
Save openvsx-deployment-no-es.yml file on your file system, then navigate to that directory and run command to deploy Open VSX:
oc process -f openvsx-deployment-no-es.yml \ -p OPENVSX_SERVER_IMAGE=registry.redhat.io/devspaces/openvsx-rhel9:3.26 \ | oc apply -f -Verify that all pods in the
namespace are running and ready. It might take a few minutes for all pods to become ready. Run the following command:openvsxoc get pods -n openvsx \ -o jsonpath='{range .items[*]}{@.metadata.name}{"\t"}{@.status.phase}{"\t"}{.status.containerStatuses[*].ready}{"\n"}{end}'Add Open VSX user with PAT to the database.
Find PostgreSQL pod:
export POSTGRESQL_POD_NAME=$(oc get pods -n openvsx \ -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)Insert username into OpenVSX database:
oc exec -n openvsx "$POSTGRESQL_POD_NAME" -- bash -c \ "psql -d openvsx -c \"INSERT INTO user_data (id, login_name, role) VALUES (1001, 'eclipse-che', 'privileged');\""Insert user PAT into OpenVSX database:
oc exec -n openvsx "$POSTGRESQL_POD_NAME" -- bash -c \ "psql -d openvsx -c \"INSERT INTO personal_access_token (id, user_data, value, active, created_timestamp, accessed_timestamp, description) VALUES (1001, 1001, 'eclipse_che_token', true, current_timestamp, current_timestamp, 'extensions publisher');\""Configure OpenShift Dev Spaces to use the internal Open VSX.
export CHECLUSTER_NAME="$(oc get checluster --all-namespaces -o json | jq -r '.items[0].metadata.name')" && export CHECLUSTER_NAMESPACE="$(oc get checluster --all-namespaces -o json | jq -r '.items[0].metadata.namespace')" && export OPENVSX_ROUTE_URL="$(oc get route internal -n openvsx -o jsonpath='{.spec.host}')" && export PATCH='{"spec":{"components":{"pluginRegistry":{"openVSXURL":"https://'"$OPENVSX_ROUTE_URL"'"}}}}' && oc patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}"TipRefer to the Section 6.3, “Open VSX registry URL” for detailed instructions on configuring the Open VSX registry URL in OpenShift Dev Spaces.
Publish Visual Studio Code extensions with the
command.ovsxNoteAt the beginning, the Open VSX registry does not provide any extension.
With everything configured, the next step is to publish a Visual Studio Code extension from inside the openvsx-server container. To do this, you need two pieces of information: the extension
name (used for publishing), the download URL of the .vsix extension package. Once you have this information, run the following commands to publish the extension:namespaceRetrieve the name of the pod running the Open VSX server:
export OVSX_POD_NAME=$(oc get pods -n openvsx -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep ^openvsx-server)Download the .vsix extension:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix EXTENSION_DOWNLOAD_URL "Create an extension namespace:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace EXTENSION_NAMESPACE_NAME" || truePublish the extension:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix"Delete the downloaded extension file:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"TipExample: Publish the
extension version 1.18.0:redhat.vscode-yamloc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix https://open-vsx.org/api/redhat/vscode-yaml/1.18.0/file/redhat.vscode-yaml-1.18.0.vsix " && oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace redhat" || true && oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix" && oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
Verify Open VSX extension registry.
Check the list of published extensions by navigating to the URL defined in the OPENVSX_ROUTE_URL environment variable.
6.2.3. Setting Up Internal Access to the Open VSX Service Copy linkLink copied to clipboard!
In addition to using a public route to reference the Open VSX registry, you can also configure OpenShift Dev Spaces to set internal cluster service routing. This method provides enhanced security by keeping traffic confined within the cluster, avoiding public exposure.
Procedure
Steps for Internal Service Routing:
Remove the Public Route.
Delete the public route associated with the Open VSX registry to restrict external access:
oc delete route internal -n openvsxSet the Internal Open VSX Service URL.
Update the CheCluster custom resource to use the internal cluster service DNS:
export CHECLUSTER_NAME="$(oc get checluster --all-namespaces -o json | jq -r '.items[0].metadata.name')" && export CHECLUSTER_NAMESPACE="$(oc get checluster --all-namespaces -o json | jq -r '.items[0].metadata.namespace')" && export PATCH='{"spec":{"components":{"pluginRegistry":{"openVSXURL":"http://openvsx-server.openvsx.svc:8080"}}}}' && oc patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}"
Additional resources
6.3. Open VSX registry URL Copy linkLink copied to clipboard!
To search and install extensions, the Microsoft Visual Studio Code - Open Source editor uses an embedded Open VSX registry instance. You can also configure OpenShift Dev Spaces to use another Open VSX registry instance rather than the embedded one.
Procedure
Set the URL of your Open VSX registry instance in the CheCluster Custom Resource
field.spec.components.pluginRegistry.openVSXURLspec: components: # [...] pluginRegistry: openVSXURL: <your_open_vsx_registy> # [...]WarningDue to the dedicated Microsoft Terms of Use, Visual Studio Code Marketplace is not supported by Red Hat OpenShift Dev Spaces.