このコンテンツは選択した言語では利用できません。
Chapter 19. Manage IDE extensions
Manage IDE extensions in OpenShift Dev Spaces workspaces to control which extensions are available, trusted, and pre-installed for users across different IDE types.
19.1. Extensions for Microsoft Visual Studio Code - Open Source リンクのコピーリンクがクリップボードにコピーされました!
OpenShift Dev Spaces uses an Open VSX registry instance to manage extensions for Microsoft Visual Studio Code - Open Source.
To manage extensions, this IDE uses one of the 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 the public open-vsx.org registry. 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.
19.2. Configure the Open VSX registry URL リンクのコピーリンクがクリップボードにコピーされました!
To search and install extensions, the Microsoft Visual Studio Code - Open Source editor in OpenShift Dev Spaces uses an embedded Open VSX registry instance. Configure OpenShift Dev Spaces to use another Open VSX registry instance rather than the embedded one.
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 OpenShift cluster where OpenShift Dev Spaces is deployed.
-
You have an active
ocsession with administrative permissions to the destination OpenShift cluster. See Getting started with the CLI.
Procedure
Edit the
CheClustercustom resource to update theopenVSXURLvalue:spec: components: pluginRegistry: openVSXURL: "<url_of_an_open_vsx_registry_instance>"where:
<url_of_an_open_vsx_registry_instance>The URL of the Open VSX registry instance. For example:
openVSXURL: "https://open-vsx.org".-
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 also point
openVSXURLat the URL of a standalone Open VSX registry instance. The URL must be accessible from within your organization’s cluster and not blocked by a proxy.
NoteTo ensure the stability and performance of the community-supported Open VSX Registry, API usage is organized into defined tiers. The Eclipse Foundation implements these limits to protect infrastructure from high-frequency automated traffic and to provide consistent service quality for all users. For more information, see Rate Limits and Usage Tiers and the open-vsx.org wiki.
ImportantUsing https://open-vsx.org is not recommended in an air-gapped environment, isolated from the internet. 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.
WarningDue to the dedicated Microsoft Terms of Use, Visual Studio Code Marketplace is not supported by Red Hat OpenShift Dev Spaces.
-
To select the embedded Open VSX registry instance in the
Verification
-
Confirm that the
plugin-registrypod has restarted and is running. - Open a workspace and verify that extensions are available from the selected registry instance in the Extensions view.
19.3. Add or remove extensions in an OpenShift Dev Spaces workspace リンクのコピーリンクがクリップボードにコピーされました!
Customize the embedded Open VSX registry instance by adding or removing extensions directly within an OpenShift Dev Spaces workspace to create a custom extension catalog for your organization.
The embedded plugin registry is deprecated; the Open VSX Registry is its successor. Setting up an internal, on-premises Open VSX Registry provides full control over the extension lifecycle, enables offline use, and improves compliance. See Section 19.5, “Deploy Open VSX using an OpenShift Dev Spaces workspace” or Section 19.6, “Deploy Open VSX using the OpenShift CLI” 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.
-
You have the custom plugin registry built locally on the corresponding hardware for IBM Power (
ppc64le) and IBM Z (s390x) architectures. - You have a container image based on the latest tag or SHA to include the latest security fixes.
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 and not Open VSX, ask the extension publisher to publish it on open-vsx.org. See the publishing instructions and the GitHub action.
If the publisher is unavailable or unwilling, and no Open VSX equivalent exists, consider reporting an issue to the Open VSX team.
-
Open the
openvsx-sync.jsonfile in the repository. Add or remove extensions using the following JSON syntax:
{ "id": "<publisher>.<name>", "version": "<extension_version>" }TipIf you have a closed-source or internal-only extension, you can add it directly from a
.vsixfile. Use 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.
19.4. Add or remove extensions from the Linux command line リンクのコピーリンクがクリップボードにコピーされました!
Build and publish a custom plugin registry from the Linux command line to create a tailored Open VSX registry with the specific extensions your organization needs.
Prerequisites
- You have podman installed.
- You have Node.js version 18.20.3 or higher installed.
- You have created a Red Hat Registry Service Account and have the username and token available.
- You have a container image based on the latest tag or SHA to include the latest security fixes.
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-registry/Log 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 and not Open VSX, ask the extension publisher to publish it on open-vsx.org. See the publishing instructions and the GitHub action.
If the publisher is unavailable or unwilling, and no Open VSX equivalent exists, 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 or internal-only extension, you can add it directly from a
.vsixfile. Use 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.
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:custom>Edit 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.
19.5. Deploy Open VSX using an OpenShift Dev Spaces workspace リンクのコピーリンクがクリップボードにコピーされました!
Deploy and configure an on-premises Eclipse Open VSX extension registry by using an OpenShift Dev Spaces workspace with the Open VSX repository.
Prerequisites
- You are logged in as a cluster administrator.
-
For IBM Power (ppc64le) or IBM Z (s390x) architectures: the
elasticsearchcomponent is removed from the .devfile.yaml, or you use the CLI-based deployment instead.
Procedure
Create a workspace by using the Eclipse Open VSX repository v0.31.0.
ImportantUse the v0.31.0 tag specifically to avoid database schema compatibility issues. Later versions require additional database columns that are not handled by the devfile tasks.
-
Run the
2.1. Create Namespace for OpenVSXtask in the workspace (Terminal>Run Task…>devfile>2.1. Create Namespace for OpenVSX). A new OpenShift project with the nameopenvsxis created on the cluster. Run the
2.4.1. Deploy Custom OpenVSXtask in the workspace (Terminal>Run Task…>devfile>2.4.1. Deploy Custom OpenVSX). When the task prompts for the Open VSX server image, enterregistry.redhat.io/devspaces/openvsx-rhel9:3.27.1.After the deployment completes, the
openvsxproject has two components:PostgreSQL databaseandOpen VSX server. The Open VSX UI is accessible through an exposed route in the OpenShift cluster. Deployment information is in thedeploy/openshift/openvsx-deployment-no-es.ymlfile with default values such asOVSX_PAT_BASE64.Run the
2.5. Add OpenVSX user with PAT to the DBtask in the workspace (Terminal>Run Task…>devfile>2.5. Add OpenVSX user with PAT to the DB). The command prompts for the Open VSX username and user PAT. The default values are used if no custom values are entered.The user PAT must match the decoded value of
OVSX_PAT_BASE64specified in the deployment file. If you updateOVSX_PAT_BASE64, use the new decoded value as the user PAT.-
Run the
2.6. Configure Che to use the internal Open VSX registrytask in the workspace (Terminal>Run Task…>devfile>2.6. Configure Che to use the internal OpenVSX registry). The task patches theCheClustercustom resource to use the specified Open VSX URL for the extension registry. -
After the
openvsx-serverpod is running and in the Ready state, run the2.8. Publish a Visual Studio Code Extension from a VSIX filetask to publish an extension from a.vsixfile (Terminal>Run Task…>devfile>2.8. Publish a Visual Studio Code Extension from a VSIX file). The command prompts for the extension’snamespacename and the path to the.vsixfile. -
Optional: To publish multiple extensions, update the
deploy/openshift/extensions.txtfile with the download URLs of each.vsixfile, then run the2.9. Publish list of Visual Studio Code Extensionstask (Terminal>Run Task…>devfile>2.9. Publish list of Visual Studio Code Extensions).
Verification
- Start any workspace and verify the published extensions are available in the Extensions view of the workspace IDE.
-
Open the
internalroute in theopenvsxOpenShift project to verify the Open VSX registry UI.
19.6. Deploy Open VSX using the OpenShift CLI リンクのコピーリンクがクリップボードにコピーされました!
Deploy and configure an on-premises Eclipse Open VSX extension registry by using the oc CLI tool.
Prerequisites
-
You have the
octool installed. You are logged in to the OpenShift cluster where 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- Save the openvsx-deployment-no-es.yml file on your file system.
Deploy Open VSX from the directory where you saved the file:
oc process -f openvsx-deployment-no-es.yml \ -p OPENVSX_SERVER_IMAGE=registry.redhat.io/devspaces/openvsx-rhel9:3.27 \ | oc apply -f -Verify that all pods in the
openvsxnamespace are running and ready:oc get pods -n openvsx \ -o jsonpath='{range .items[]}{@.metadata.name}{"\t"}{@.status.phase}{"\t"}{.status.containerStatuses[].ready}{"\n"}{end}'Add an Open VSX user with PAT to the database.
Find the PostgreSQL pod:
export POSTGRESQL_POD_NAME=$(oc get pods -n openvsx \ -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)Insert the username into the 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 the user PAT into the 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 Section 19.2, “Configure the 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. The Open VSX registry does not provide any extension by default. You need the extensionnamespacename and the download URL of the.vsixpackage.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
.vsixextension: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"
Optional: Remove the public route to configure internal access to the Open VSX service:
oc delete route internal -n openvsxOptional: Set the internal Open VSX service URL so that OpenShift Dev Spaces uses internal cluster service routing instead of a public route:
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}"
Verification
- Check the list of published extensions by navigating to the Open VSX route URL or the internal service URL.
19.7. Delete an extension by using the Open VSX administrator API リンクのコピーリンクがクリップボードにコピーされました!
Delete an extension from your private Open VSX registry by calling the administrator API with an administrator user and a Personal Access Token (PAT).
Prerequisites
-
You have access to the OpenShift cluster where the Open VSX registry is deployed in the
openvsxproject.
Procedure
Add the Open VSX administrator user and PAT to the database:
POD=$(oc get pods -n openvsx -l app=openvsx-db -o jsonpath='{.items[0].metadata.name}')oc exec -n openvsx "$POD" -- psql -d openvsx -c \ "INSERT INTO user_data (id, login_name, role) VALUES (1002, 'openvsx-admin', 'admin');"oc exec -n openvsx "$POD" -- psql -d openvsx -c \ "INSERT INTO personal_access_token (id, user_data, value, active, created_timestamp, accessed_timestamp, description) VALUES (1002, 1002, '<your_admin_token>', true, current_timestamp, current_timestamp, 'Admin API Token');"NoteUse a strong, unique value for
<your_admin_token>in production environments.Delete an extension and all its versions:
curl -X POST \ "https://<your_openvsx_server_url>/admin/api/extension/<publisher>/<extension>/delete?token=<your_admin_token>"where:
<your_openvsx_server_url>- The URL of the Open VSX server.
<publisher>- The extension publisher name.
<extension>- The extension name.
<your_admin_token>- The PAT value created in step 1.
Optional: Delete a specific version of an extension:
curl -X POST \ -H "Content-Type: application/json" \ -d '[{"version": "<version>", "targetPlatform": "<platform>"}]' \ "https://<your_openvsx_server_url>/admin/api/extension/<publisher>/<extension>/delete?token=<your_admin_token>"You can list multiple version and platform pairs in the JSON array.
Verification
- Refresh the Open VSX registry and verify that the extension no longer appears.
19.8. Delete an extension from the PostgreSQL database directly リンクのコピーリンクがクリップボードにコピーされました!
Delete an extension from the PostgreSQL database directly when the administrator API is not available or when you need specific data cleanup.
Prerequisites
-
You have access to the OpenShift cluster where the Open VSX registry is deployed in the
openvsxproject. - You know the namespace name and extension name to delete.
Procedure
Identify the PostgreSQL pod:
POD=$(oc get pods -n openvsx -l app=openvsx-db -o jsonpath='{.items[0].metadata.name}')Connect to the PostgreSQL database:
oc exec -it -n openvsx "$POD" -- psql\c openvsxFind the namespace ID and extension ID:
SELECT id, name FROM namespace WHERE name = '<namespace_name>';SELECT id, name, namespace_id FROM extension WHERE namespace_id = <namespace_id> AND name = '<extension_name>';Optional: Preview extension versions and file resources before deleting:
SELECT id, version, target_platform FROM extension_version WHERE extension_id = <extension_id>;SELECT id, name, storage_type FROM file_resource WHERE extension_id = <extension_id>;If
storage_typeislocal, you must also remove the files from the file system after deleting the database records.Delete the extension from the database:
BEGIN; DELETE FROM file_resource WHERE extension_id = <extension_id>; DELETE FROM extension_review WHERE extension_id = <extension_id>; DELETE FROM extension_version WHERE extension_id = <extension_id>; DELETE FROM extension WHERE id = <extension_id>; COMMIT;ImportantRun these commands in order within one transaction. Do not skip the
COMMITstatement.If the
storage_typeislocal, remove the extension files from local storage:SERVER_POD=$(oc get pods -n openvsx -l app=openvsx-server -o jsonpath='{.items[0].metadata.name}')oc exec -n openvsx "$SERVER_POD" -- rm -rf /tmp/extensions/<publisher>/<extension>
Verification
- Refresh the Open VSX registry and verify that the extension no longer appears.