Skip to content

Commit d1df07a

Browse files
committed
Add a command to publish extension by ovsx
Signed-off-by: Valeriy Svydenko <[email protected]>
1 parent 226b8fe commit d1df07a

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.devfile.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ commands:
187187
188188
- id: enable-internal-openvsx
189189
exec:
190-
label: "2.5. Configure Che to use the internal Open VSX registry"
190+
label: "2.5. Configure Che to use the internal OpenVSX registry"
191191
component: tool
192192
workingDir: ${PROJECTS_ROOT}/openvsx/openshift
193193
commandLine: |
@@ -196,3 +196,22 @@ commands:
196196
export OPENVSX_ROUTE_URL="$(oc get route internal -n "$OPENVSX_NAMESPACE" -o jsonpath='{.spec.host}')" &&
197197
export PATCH='{"spec":{"components":{"pluginRegistry":{"openVSXURL":"https://'"$OPENVSX_ROUTE_URL"'"}}}}' &&
198198
kubectl patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}"
199+
200+
- id: publish-extension
201+
exec:
202+
label: "2.6. Publish VS Code Extension to the internal OpenVSX"
203+
component: tool
204+
commandLine: |
205+
read -p "Please enter extension's namespace name: " EXTENSION_NAMESPACE_NAME
206+
EXTENSION_NAMESPACE_NAME=${EXTENSION_NAMESPACE_NAME}
207+
export EXTENSION_NAMESPACE_NAME
208+
echo "EXTENSION_NAMESPACE_NAME is set to $EXTENSION_NAMESPACE_NAME"
209+
read -p "Please enter extension's download URL: " EXTENSION_DOWNLOAD_URL
210+
EXTENSION_DOWNLOAD_URL=${EXTENSION_DOWNLOAD_URL}
211+
export EXTENSION_DOWNLOAD_URL
212+
echo "EXTENSION_DOWNLOAD_URL is set to $EXTENSION_DOWNLOAD_URL"
213+
export OVSX_POD_NAME=$(kubectl get pods -n "$OPENVSX_NAMESPACE" -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep ^ovsx-cli) &&
214+
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix '$EXTENSION_DOWNLOAD_URL' " &&
215+
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace '$EXTENSION_NAMESPACE_NAME'" || true &&
216+
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix" &&
217+
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"

openshift/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,27 @@ In the workspace, you'll find a set of predefined commands from the `devfile.yam
1212
* 2.1. Build and Publish OpenVSX Image
1313

1414
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).
15+
1516
* 2.2. Build and Publish OpenVSX CLI Image
1617

1718
Build the OpenVSX CLI image and push it to the OpenShift internal registry.
19+
1820
* 2.3. Deploy OpenVSX
1921

2022
Deploy the OpenVSX registry using the provided `openvsx-deployment.yml` template
23+
2124
* 2.4. Add OpenVSX user with PAT to the DB
2225

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

25-
* 2.5. Configure Che to use the internal Open VSX registry
28+
* 2.5. Configure Che to use the internal OpenVSX registry
2629

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

32+
* 2.6. Publish VS Code Extension to the internal OpenVSX
33+
34+
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.
35+
2936
## OpenShift Template (openvsx-deployment.yml)
3037
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.
3138

0 commit comments

Comments
 (0)