-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a command to publish list of extensions into OpenVSX registry dep…
…loyed on OpenShift Signed-off-by: Valeriy Svydenko <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
https://open-vsx.org/api/redhat/vscode-xml/0.27.1/file/redhat.vscode-xml-0.27.1.vsix | ||
https://open-vsx.org/api/redhat/vscode-yaml/1.15.0/file/redhat.vscode-yaml-1.15.0.vsix | ||
https://open-vsx.org/api/redhat/java/1.35.1/file/redhat.java-1.35.1.vsix | ||
https://open-vsx.org/api/vscode/html-language-features/1.88.1/file/vscode.html-language-features-1.88.1.vsix | ||
https://open-vsx.org/api/redhat/vscode-quarkus/1.18.1/file/redhat.vscode-quarkus-1.18.1.vsix | ||
https://open-vsx.org/api/redhat/fabric8-analytics/0.9.5/file/redhat.fabric8-analytics-0.9.5.vsix | ||
https://open-vsx.org/api/redhat/vscode-redhat-account/0.2.0/file/redhat.vscode-redhat-account-0.2.0.vsix | ||
https://open-vsx.org/api/redhat/vscode-openshift-connector/linux-x64/1.16.0/file/[email protected] | ||
https://open-vsx.org/api/redhat/vscode-commons/0.0.6/file/redhat.vscode-commons-0.0.6.vsix | ||
https://open-vsx.org/api/redhat/vscode-tekton-pipelines/1.0.1/file/redhat.vscode-tekton-pipelines-1.0.1.vsix | ||
https://open-vsx.org/api/ms-python/python/2024.14.1/file/ms-python.python-2024.14.1.vsix | ||
https://open-vsx.org/api/redhat/ansible/24.8.4/file/redhat.ansible-24.8.4.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# This script automates the process of downloading, configuring, and publishing VS Code extensions to an OpenVSX registry | ||
# deployed on an OpenShift cluster. | ||
|
||
# Path to the extensions.txt file | ||
current_dir=$(pwd) | ||
EXTENSIONS_FILE="$current_dir/extensions.txt" | ||
|
||
listOfPublishers=() | ||
containsElement () { for e in "${@:2}"; do [[ "$e" = "$1" ]] && return 0; done; return 1; } | ||
|
||
# Get ovsx-cli pod name | ||
export OVSX_POD_NAME=$(kubectl get pods -n "$OPENVSX_NAMESPACE" -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep ^ovsx-cli) | ||
|
||
# Read the extensions.txt file line by line | ||
while IFS= read -r line; do | ||
# Extract the vsix file name from the URL | ||
vsix_url="$line" | ||
vsix_filename=$(basename "$vsix_url") | ||
|
||
# Download the vsix file into the /tmp directory | ||
echo "Downloading $vsix_url" | ||
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "wget -q -P /tmp '$vsix_url' " | ||
|
||
# Extract namespace_name (everything before the first .) | ||
namespace_name=$(echo "$vsix_filename" | cut -d. -f1) | ||
|
||
# Execute ovsx commands | ||
# check if publisher is in the list of publishers | ||
if ! containsElement "${namespace_name}" "${listOfPublishers[@]}"; then | ||
listOfPublishers+=("${namespace_name}") | ||
# create namespace | ||
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace '$namespace_name'" || true | ||
fi | ||
# publish extension | ||
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/'$vsix_filename'" | ||
|
||
# remove the downloaded file | ||
kubectl exec -n "${OPENVSX_NAMESPACE}" "${OVSX_POD_NAME}" -- bash -c "rm /tmp/'$vsix_filename'" | ||
done < "$EXTENSIONS_FILE" |