Skip to content

Commit

Permalink
Add a command to publish extension by ovsx
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Svydenko <[email protected]>
  • Loading branch information
svor committed Oct 24, 2024
1 parent 226b8fe commit d1df07a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
21 changes: 20 additions & 1 deletion .devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ commands:
- id: enable-internal-openvsx
exec:
label: "2.5. Configure Che to use the internal Open VSX registry"
label: "2.5. Configure Che to use the internal OpenVSX registry"
component: tool
workingDir: ${PROJECTS_ROOT}/openvsx/openshift
commandLine: |
Expand All @@ -196,3 +196,22 @@ commands:
export OPENVSX_ROUTE_URL="$(oc get route internal -n "$OPENVSX_NAMESPACE" -o jsonpath='{.spec.host}')" &&
export PATCH='{"spec":{"components":{"pluginRegistry":{"openVSXURL":"https://'"$OPENVSX_ROUTE_URL"'"}}}}' &&
kubectl patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}"
- id: publish-extension
exec:
label: "2.6. Publish VS Code Extension to the internal OpenVSX"
component: tool
commandLine: |
read -p "Please enter extension's namespace name: " EXTENSION_NAMESPACE_NAME
EXTENSION_NAMESPACE_NAME=${EXTENSION_NAMESPACE_NAME}
export EXTENSION_NAMESPACE_NAME
echo "EXTENSION_NAMESPACE_NAME is set to $EXTENSION_NAMESPACE_NAME"
read -p "Please enter extension's download URL: " EXTENSION_DOWNLOAD_URL
EXTENSION_DOWNLOAD_URL=${EXTENSION_DOWNLOAD_URL}
export EXTENSION_DOWNLOAD_URL
echo "EXTENSION_DOWNLOAD_URL is set to $EXTENSION_DOWNLOAD_URL"
export OVSX_POD_NAME=$(kubectl get pods -n "$OPENVSX_NAMESPACE" -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep ^ovsx-cli) &&
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix '$EXTENSION_DOWNLOAD_URL' " &&
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace '$EXTENSION_NAMESPACE_NAME'" || true &&
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix" &&
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
9 changes: 8 additions & 1 deletion openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@ In the workspace, you'll find a set of predefined commands from the `devfile.yam
* 2.1. Build and Publish OpenVSX Image

Build the OpenVSX image and push it to the OpenShift internal registry. You'll ask to enter the OpenVSX version to deploy (default is v0.17.0).

* 2.2. Build and Publish OpenVSX CLI Image

Build the OpenVSX CLI image and push it to the OpenShift internal registry.

* 2.3. Deploy OpenVSX

Deploy the OpenVSX registry using the provided `openvsx-deployment.yml` template

* 2.4. Add OpenVSX user with PAT to the DB

This command adds a new OpenVSX user along with a Personal Access Token (PAT) to the PostgreSQL database.

* 2.5. Configure Che to use the internal Open VSX registry
* 2.5. Configure Che to use the internal OpenVSX registry

In case you have deployed Eclipse Che on the cluster, you can patch it to use your private OpenVSX registry.

* 2.6. Publish VS Code Extension to the internal OpenVSX

This command facilitates publishing a VS Code extension to the local OpenVSX registry. It prompts the user to provide the extension's namespace name and download URL. The extension is then downloaded into a temporary folder inside the ovsx-cli pod, a namespace is created (if not already present), and the extension is published to the OpenVSX registry. Afterward, the temporary file is deleted. This command is ideal for adding custom or internal extensions to a local OpenVSX instance.

## OpenShift Template (openvsx-deployment.yml)
You can find the deployment YAML configuration in the `openvsx-deployment.yml` file. This template defines the deployments, services, and route for the PostgreSQL database, Elasticsearch, OpenVSX Server, and OpenVSX CLI.

Expand Down

0 comments on commit d1df07a

Please sign in to comment.