Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
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 Link kopierenLink in die Zwischenablage kopiert!
To manage extensions, this IDE uses one of these Open VSX registry instances:
-
The embedded instance of the Open VSX registry that runs in the
plugin-registry
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. This subset is customizable. - 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 Link kopierenLink in die Zwischenablage kopiert!
The default is the embedded instance of the Open VSX registry.
If the default Open VSX registry instance is not what you need, you can select one of the following instances:
-
The Open VSX registry instance at
https://open-vsx.org
that requires access to the internet. - A standalone Open VSX registry instance that is deployed on a network accessible from OpenShift Dev Spaces workspace pods.
Procedure
Edit the
openVSXURL
value in theCheCluster
custom resource:spec: components: pluginRegistry: openVSXURL: "<url_of_an_open_vsx_registry_instance>"
spec: components: pluginRegistry: openVSXURL: "<url_of_an_open_vsx_registry_instance>"
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For example:
openVSXURL: "https://open-vsx.org"
.
Important- Using https://open-vsx.org is not recommended in an air-gapped environment, isolated from the internet. In order to reduce the risk of malware infections and unauthorized access to your code use the embedded or self-hosted Open VSX registry with a curated set of extensions.
-
To select the embedded Open VSX registry instance in the
plugin-registry
pod, useopenVSXURL: ''
. You can customize the list of included extensions. -
You can also point
openVSXURL
at the URL of a standalone Open VSX registry instance if its URL is accessible from within your organization’s cluster and not blocked by a proxy.
6.1.2. Adding or removing extensions in the embedded Open VSX registry instance Link kopierenLink in die Zwischenablage kopiert!
You can manage Visual Studio Code extensions by setting up and using an internal, on-premises Open VSX registry. This approach provides full control over the extension lifecycle, enables offline use, and improves compliance. The embedded plugin registry will be deprecated in future releases, with the Open VSX registry serving as its successor. Refer to the Section 6.2, “Running Open VSX On-Premises” for detailed setup instructions.
You can add or remove extensions in the embedded Open VSX registry instance. This results in a custom build of the Open VSX registry that can be used in your organization’s workspaces.
To get the latest security fixes after a OpenShift Dev Spaces update, rebuild your container based on the latest tag or SHA.
Procedure
Get the publisher and extension name of each chosen extension:
- Find the extension on the Open VSX registry website and copy the URL of the extension’s listing page and extension’s version.
Extract the <publisher> and <extension> name from the copied URL:
https://open-vsx.org/extension/<publisher>/<name>
https://open-vsx.org/extension/<publisher>/<name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipIf the extension is only available from Microsoft Visual Studio Marketplace, but not Open VSX, you can ask the extension publisher to also 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.
Build the custom plugin registry image and update CheCluster custom resource:
Tip- During the build process, each extension will be verified for compatibility with the version of Visual Studio Code used in OpenShift Dev Spaces.
Using OpenShift Dev Spaces instance:
ImportantFor IBM Power (
ppc64le
) and IBM Z (s390x
), the custom plugin registry is expected to be built locally on the corresponding architecture.- Login to your OpenShift Dev Spaces instance as an administrator.
Create a new Red Hat Registry Service Account and copy username and token.
- Start a workspace using the plugin registry repository.
-
Open the
openvsx-sync.json
file and add or remove extensions. -
Run
1. Login to registry.redhat.io
task in the workspace (TerminalRun Task… devfile 1. Login to registry.redhat.io) and login to registry.redhat.io. Run
2. Build and Publish a Custom Plugin Registry
task in the workspace (TerminalRun Task… devfile 2. Build and Publish a Custom Plugin Registry). NoteCheck
CHE_CODE_VERSION
in thebuild-config.json
file and update it if necessary. This variable must match the version of the editor currently used with OpenShift Dev Spaces.Run
3. Configure Che to use the Custom Plugin Registry
task in the workspace (TerminalRun Task… devfile 3. Configure Che to use the Custom Plugin Registry). Using Linux operating system:
Tip- Podman and NodeJS version 18.20.3 or higher should be installed in the system.
Download or fork and clone the Plugin registry repository.
git clone https://github.com/redhat-developer/che-plugin-registry.git
git clone https://github.com/redhat-developer/che-plugin-registry.git
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Go to the plugin registry project directory:
cd che-plugin-registry/
cd che-plugin-registry/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new Red Hat Registry Service Account and copy username and token.
Login to registry.redhat.io:
podman login registry.redhat.io
podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For each extension that you need to add or remove, edit the
openvsx-sync.json
file:-
To add extensions, add the publisher, name and extension version to the
openvsx-sync.json
file. -
To remove extensions, remove the publisher, name and extension version from the
openvsx-sync.json
file. Use the following JSON syntax:
{ "id": "<publisher>.<name>", "version": "<extension_version>" }
{ "id": "<publisher>.<name>", "version": "<extension_version>" }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
.vsix
file by using a URL accessible to your custom plugin registry container:{ "id": "<publisher>.<name>", "download": "<url_to_download_vsix_file>", "version": "<extension_version>" }
{ "id": "<publisher>.<name>", "download": "<url_to_download_vsix_file>", "version": "<extension_version>" }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Read the Terms of Use for the Microsoft Visual Studio Marketplace before using its resources.
-
To add extensions, add the publisher, name and extension version to the
Build the plugin registry container image and publish it to a container registry such as quay.io:
./build.sh -o <username> -r quay.io -t custom
$ ./build.sh -o <username> -r quay.io -t custom
Copy to Clipboard Copied! Toggle word wrap Toggle overflow podman push quay.io/<username/plugin_registry:custom>
$ podman push quay.io/<username/plugin_registry:custom>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Edit the
CheCluster
custom resource in your organization’s cluster to point to the image (for example, on quay.io) and save the changes:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
Check that the
plugin-registry
pod has restarted and is running. - Restart the workspace and check the available extensions in the Extensions view of the workspace IDE.
6.2. Running Open VSX On-Premises Link kopierenLink in die Zwischenablage kopiert!
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 Link kopierenLink in die Zwischenablage kopiert!
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
elasticsearch
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.TipThe environment, including all necessary commands, is defined in the
.devfile.yaml
file.Create a new OpenShift project for Open VSX.
Run
2.1. Create Namespace for OpenVSX
task in the workspace (Terminal
). A new project with the nameRun Task… devfile 2.1. Create Namespace for OpenVSX openvsx
should be created on the cluster.Deploy Open VSX.
Run
2.4.1. Deploy Custom OpenVSX
task 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.23
into the terminal. As a result, in the OpenShift console, you can find theopenvsx
project with two components:PostgreSQL database
andOpen 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.yml
file 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 DB
task 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_BASE64
specified in the deployment file. IfOVSX_PAT_BASE64
has 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 registry
task in the workspace (Terminal
). It applies the patch to theRun Task… devfile 2.6. Configure Che to use the internal OpenVSX registry CheCluster
custom resource, updating its configuration to use the specified Open VSX URL for the extension registry.Publish an extension from a
.vsix
file.At the beginning, the Open VSX registry does not provide any extension. Once the
openvsx-server
pod 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 file
command publishes an extension to the local Open VSX registry directly from a.vsix
file. It prompts you to provide the extension’snamespace
name and the path to the.vsix
file.Publish list of extensions.
The
2.9. Publish list of Visual Studio Code Extensions
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.TipThe command reads from the
deploy/openshift/extensions.txt
file, which lists the URLs of.vsix
files for each extension to be published. To publish your extensions to Open VSX, update theextensions.txt
file 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
internal
route in the OpenVSX OpenShift project.
6.2.2. Using OpenShift CLI (oc) tool Link kopierenLink in die Zwischenablage kopiert!
Prerequisites
-
Installed
oc
tool. 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 openvsx
oc new-project openvsx
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy 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.23 \ | oc apply -f -
oc process -f openvsx-deployment-no-es.yml \ -p OPENVSX_SERVER_IMAGE=registry.redhat.io/devspaces/openvsx-rhel9:3.23 \ | oc apply -f -
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that all pods in the
openvsx
namespace 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}'
oc get pods -n openvsx \ -o jsonpath='{range .items[*]}{@.metadata.name}{"\t"}{@.status.phase}{"\t"}{.status.containerStatuses[*].ready}{"\n"}{end}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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)
export POSTGRESQL_POD_NAME=$(oc get pods -n openvsx \ -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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');\""
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');\""
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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');\""
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');\""
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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}"
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}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ovsx
command.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
namespace
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: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)
export OVSX_POD_NAME=$(oc get pods -n openvsx -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep ^openvsx-server)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Download the .vsix extension:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix EXTENSION_DOWNLOAD_URL "
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix EXTENSION_DOWNLOAD_URL "
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an extension namespace:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace EXTENSION_NAMESPACE_NAME" || true
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace EXTENSION_NAMESPACE_NAME" || true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Publish the extension:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix"
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Delete the downloaded extension file:
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
oc exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipExample: Publish the
redhat.vscode-yaml
extension 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"
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"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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 Link kopierenLink in die Zwischenablage kopiert!
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 openvsx
oc delete route internal -n openvsx
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set 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}"
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}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
6.3. Open VSX registry URL Link kopierenLink in die Zwischenablage kopiert!
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.openVSXURL
field.Copy to Clipboard Copied! Toggle word wrap Toggle overflow WarningDue to the dedicated Microsoft Terms of Use, Visual Studio Code Marketplace is not supported by Red Hat OpenShift Dev Spaces.