-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework plugin samples to separate components better
Move remote-runtime-injector and vsx-installer to separate plugins that are imported by theia, rather than having a huge theia plugin definition Signed-off-by: Angel Misevski <amisevsk@redhat.com>
- Loading branch information
Showing
3 changed files
with
76 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
kind: DevWorkspaceTemplate | ||
apiVersion: workspace.devfile.io/v1alpha2 | ||
metadata: | ||
name: remote-runtime-injector | ||
spec: | ||
components: | ||
- name: remote-runtime-injector | ||
attributes: | ||
"app.kubernetes.io/part-of": che-theia.eclipse.org | ||
"app.kubernetes.io/component": bootstrapper | ||
container: #### corresponds to `initContainer` definition in old meta.yaml. | ||
image: "quay.io/eclipse/che-theia-endpoint-runtime-binary:7.20.0" | ||
volumeMounts: | ||
- path: "/remote-endpoint" | ||
name: remote-endpoint | ||
env: | ||
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE | ||
value: /remote-endpoint/plugin-remote-endpoint | ||
- name: REMOTE_ENDPOINT_VOLUME_NAME | ||
value: remote-endpoint | ||
commands: | ||
- id: inject-theia-in-remote-sidecar | ||
apply: | ||
component: remote-runtime-injector | ||
events: | ||
preStart: | ||
- inject-theia-in-remote-sidecar |
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,40 @@ | ||
kind: DevWorkspaceTemplate | ||
apiVersion: workspace.devfile.io/v1alpha2 | ||
metadata: | ||
name: vsx-installer | ||
spec: | ||
components: | ||
- name: vsx-installer # Mainly reads the container objects and searches for those | ||
# with che-theia.eclipse.org/vscode-extensions attributes to get VSX urls | ||
# Those found in the dedicated containers components are with a sidecar, | ||
# Those found in the che-theia container are without a sidecar. | ||
attributes: | ||
"app.kubernetes.io/part-of": che-theia.eclipse.org | ||
"app.kubernetes.io/component": bootstrapper | ||
container: | ||
image: 'quay.io/samsahai/curl:latest' | ||
volumeMounts: | ||
- path: "/plugins" | ||
name: plugins | ||
args: | ||
- /bin/sh | ||
- '-c' | ||
- | | ||
KUBE_API_ENDPOINT="https://kubernetes.default.svc/apis/workspace.devfile.io/v1alpha2/namespaces/${CHE_WORKSPACE_NAMESPACE}/devworkspaces/${CHE_WORKSPACE_NAME}" &&\ | ||
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) &&\ | ||
WORKSPACE=$(curl -fsS --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer ${TOKEN}" $KUBE_API_ENDPOINT) &&\ | ||
for container in $(echo $WORKSPACE | sed -e 's;[[,]\({"attributes":{"app.kubernetes.io\);\n\1;g' | grep '"che-theia.eclipse.org/vscode-extensions":' | grep -e '^{"attributes".*'); do \ | ||
dest=$(echo "$container" | sed 's;.*{"name":"THEIA_PLUGINS","value":"local-dir://\([^"][^"]*\)"}.*;\1;' - ) ;\ | ||
urls=$(echo "$container" | sed 's;.*"che-theia.eclipse.org/vscode-extensions":\[\([^]][^]]*\)\]}.*;\1;' - ) ;\ | ||
mkdir -p $dest ;\ | ||
for url in $(echo $urls | sed 's/[",]/ /g' - ); do \ | ||
echo; echo downloading $urls to $dest; curl -L $url > $dest/$(basename $url) ;\ | ||
done \ | ||
done \ | ||
commands: | ||
- id: copy-vsx | ||
apply: | ||
component: vsx-installer | ||
events: | ||
preStart: | ||
- copy-vsx |