Skip to content

Instantly share code, notes, and snippets.

@l0rd
Created December 10, 2018 08:31
Show Gist options
  • Save l0rd/7f155e77cc20c1220ffa2e8048958202 to your computer and use it in GitHub Desktop.
Save l0rd/7f155e77cc20c1220ffa2e8048958202 to your computer and use it in GitHub Desktop.
Script to package and Publish Theia on a private registry
version: 1.0.0
type: Che Editor
name: theia-ide
id: org.eclipse.che.editor.theia
title: Eclipse Theia for Eclipse Che
Description: Eclipse Theia
Icon: https://pbs.twimg.com/profile_images/929088242456190976/xjkS2L-0_400x400.jpg
endpoints:
- name: "theia"
public: true
targetPort: 3000
attributes:
protocol: http
type: ide
secure: true
cookiesAuthEnabled: true
- name: "theia-dev"
public: true
targetPort: 3030
attributes:
protocol: http
type: ide-dev
containers:
- name: theia-ide
image: mariolet/che-theia:0.3.17
env:
- name: THEIA_PLUGINS
value: local-dir:///plugins
- name: HOSTED_PLUGIN_HOSTNAME
value: 0.0.0.0
volumes:
- mountPath: "/plugins"
name: plugins
- mountPath: "/projects"
name: projects
ports:
- exposedPort: 3000
- exposedPort: 3030
memory-limit: "2048M"
id: org.eclipse.che.editor.theia
version: 1.0.0
type: Che Editor
name: org.eclipse.che.editor.theia
title: org.eclipse.che.editor.theia
description: Automatically genarated description for org.eclipse.che.editor.theia
icon: https://www.eclipse.org/che/images/ico/16x16.png
url: http://che-plugin-registry-kube-che.192.168.99.100.nip.io/plugins/org.eclipse.che.editor.theia/1.0.0/che-editor-plugin.tar.gz
#!/bin/bash
set -e
PLUGIN_ID=org.eclipse.che.editor.theia
PLUGIN_VERSION=1.0.0
PLUGIN=che-editor-plugin.tar.gz
PLUGIN_PATH=$(pwd)/${PLUGIN}
NAMESPACE=kube-che
PROTOCOL=http
# Package the plugin
tar czf "${PLUGIN_PATH}" ./che-plugin.yaml
HOST=$(kubectl get ingress -n "${NAMESPACE}" --field-selector='metadata.name=che-plugin-registry' -o=custom-columns=":.spec.rules[0].host" | xargs)
BINARY_URL="${PROTOCOL}://$HOST/plugins/$PLUGIN_ID/$PLUGIN_VERSION/${PLUGIN}"
# Detect pod
POD_NAME=$(kubectl get pods -n "${NAMESPACE}" --output name | grep che-plugin-registry | awk -F "/" '{print $2}')
echo "Registry pod is: $POD_NAME"
# Create folder
kubectl exec -n "${NAMESPACE}" "${POD_NAME}" -- mkdir -p /var/www/html/plugins/"${PLUGIN_ID}"/"${PLUGIN_VERSION}"
# Upload binary
kubectl cp -n "${NAMESPACE}" "${PLUGIN_PATH}" "${POD_NAME}":/var/www/html/plugins/"${PLUGIN_ID}"/"${PLUGIN_VERSION}"
# Print binary link
echo "Plugin hosted at: ${BINARY_URL}"
# Create & Upload meta.yaml
cat > meta.yaml <<EOF
id: $PLUGIN_ID
version: $PLUGIN_VERSION
type: Che Editor
name: $PLUGIN_ID
title: $PLUGIN_ID
description: Automatically genarated description for $PLUGIN_ID
icon: https://www.eclipse.org/che/images/ico/16x16.png
url: $BINARY_URL
EOF
kubectl cp -n "${NAMESPACE}" ./meta.yaml "${POD_NAME}":/var/www/html/plugins/"${PLUGIN_ID}"/"${PLUGIN_VERSION}"
# Print meta link
META_URL="${PROTOCOL}://$HOST/plugins/$PLUGIN_ID/$PLUGIN_VERSION/meta.yaml"
echo "Meta hosted at: $META_URL"
# Print editor attribute e.g. "editor": "http://che-plugin-registry-kube-che.192.168.99.100.nip.io/plugins/org.eclipse.che.editor.theia:1.0.0"
EDITOR_ATTRIBUTE="\"editor\": \"${PROTOCOL}://$HOST/plugins/$PLUGIN_ID/$PLUGIN_VERSION/meta.yaml\""
echo "Workspace editor attribute: "
echo " ${EDITOR_ATTRIBUTE}"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment