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
plugin-registrypod 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. - 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
https://open-vsx.orgthat requires access to the internet. - 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
ocCLI tool installed if you are using the command line.
Procedure
- Log in to the cluster as an administrator.
Edit the
CheClustercustom resource to update theopenVSXURLvalue:spec: 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
plugin-registrypod, useopenVSXURL: ''. You can customize the list of included extensions using a workspace or using a Linux operating system. -
You can point
openVSXURLto 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.
Verification
-
Confirm that the
plugin-registrypod has restarted. - 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 (
ppc64le) and IBM Z (s390x) architectures, you must build the custom plugin registry locally on the corresponding hardware. - (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
<publisher>and<name>from the URL: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
openvsx-sync.jsonfile in the workspace. 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
.vsixfile by using a URL accessible to your custom plugin registry container:{ "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
CHE_CODE_VERSIONin thebuild-config.jsonfile matches the version of the editor currently used with OpenShift Dev Spaces. Update it if necessary.
-
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
plugin-registrypod has restarted and is running. - 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
<publisher>and<name>from the URL: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
openvsx-sync.jsonfile. 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
.vsixfile by using a URL accessible to your custom plugin registry container:{ "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
CHE_CODE_VERSIONin thebuild-config.jsonfile matches the version of the editor currently used with OpenShift Dev Spaces. Update it if necessary.Push the image to a container registry such as quay.io:
$ podman push quay.io/<username>/plugin_registry:customEdit the
CheClustercustom resource in your organization’s cluster to point to the image and save the changes:spec: components: pluginRegistry: deployment: containers: - image: quay.io/<username>/plugin_registry:custom openVSXURL: ''
Verification
-
Check that the
plugin-registrypod has restarted and is running. - 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), to help you set up a secure, internal Open VSX instance. This includes creating necessary OpenShift project, deploying Open VSX components, publishing extensions and integrating the registry with OpenShift Dev Spaces.
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
elasticsearchcomponent 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.TipThe environment, including all necessary commands, is defined in the
.devfile.yamlfile.Create a new OpenShift project for Open VSX.
Run
2.1. Create Namespace for OpenVSXtask in the workspace (Terminal). A new project with the nameRun Task… devfile 2.1. Create Namespace for OpenVSX openvsxshould be created on the cluster.Deploy Open VSX.
Run
2.4.1. Deploy Custom OpenVSXtask in the workspace (Terminal). This task will ask to provide the Open VSX server image. EnterRun Task… devfile 2.4.1. Deploy Custom OpenVSX registry.redhat.io/devspaces/openvsx-rhel9:3.26into the terminal. As a result, in the OpenShift console, you can find theopenvsxproject with two components:PostgreSQL databaseandOpen VSX server. Additionally, the Open VSX UI should be accessible through an exposed route in the OpenShift cluster.TipAll deployment information is described in the
deploy/openshift/openvsx-deployment-no-es.ymlfile with some default values such asOVSX_PAT_BASE64.Add Open VSX user with PAT to the database.
Run the
2.5. Add OpenVSX user with PAT to the DBtask in the workspace (Terminal). The command will ask for the Open VSX username and user PAT. You can just click enter to use the default values.Run Task… devfile 2.5. Add OpenVSX user with PAT to the DB ImportantThe user PAT must match the decoded value of
OVSX_PAT_BASE64specified in the deployment file. IfOVSX_PAT_BASE64has been updated, use the new token’s decoded value as the user PAT.Configure OpenShift Dev Spaces to use the internal Open VSX.
Run the
2.6. Configure Che to use the internal Open VSX registrytask in the workspace (Terminal). It applies the patch to theRun Task… devfile 2.6. Configure Che to use the internal OpenVSX registry CheClustercustom resource, updating its configuration to use the specified Open VSX URL for the extension registry.Publish an extension from a
.vsixfile.At the beginning, the Open VSX registry does not provide any extension. Once the
openvsx-serverpod is running and in the Ready state, extensions can be published to the registry. The2.8. Publish a Visual Studio Code Extension from a VSIX filecommand publishes an extension to the local Open VSX registry directly from a.vsixfile. It prompts you to provide the extension’snamespacename and the path to the.vsixfile.Publish list of extensions.
The
2.9. Publish list of Visual Studio Code Extensionscommand automates the process of publishing a predefined list of Microsoft Visual Studio Code extensions based on download URLs to the internal Open VSX registry.TipThe command reads from the
deploy/openshift/extensions.txtfile, which lists the URLs of.vsixfiles for each extension to be published. To publish your extensions to Open VSX, update theextensions.txtfile as needed, then run the 2.9. Publish list of Visual Studio Code Extensions task from the workspace:Terminal.Run 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
internalroute in the OpenVSX OpenShift project.
6.2.2. Using OpenShift CLI (oc) tool Copy linkLink copied to clipboard!
Prerequisites
-
Installed
octool. 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
openvsxnamespace are running and ready. It might take a few minutes for all pods to become ready. Run the following command:oc 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
ovsxcommand.NoteAt 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
namespacename (used for publishing), the download URL of the .vsix extension package. Once you have this information, run the following commands to publish the extension:Retrieve 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
redhat.vscode-yamlextension version 1.18.0:oc 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
spec.components.pluginRegistry.openVSXURLfield.spec: 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.