I am trying to repackage a Visual Studio Code extension into Eclipse Che as a Che-Theia plug-in.
The plug-in extracts source code metrics from Ansible files, as shown below:
It does so by executing a command-line of a tool written in Python, namely ansiblemetrics, that must be installed on the user's environment.
Therefore, I cannot add that dependency to the VSC extension's package.json. Rather, the user has to install it on the Eclipse Che workspace. Nevertheless, I want that Eclipse Che users do not need to install the dependencies when using the extension. A container looks the way to go.
I have the following Eclipse Che DevFile
Eclipse Che DevFile
apiVersion: 1.0.0
metadata:
name: python-bd3zh
attributes:
persistVolumes: 'false'
projects:
- name: python-hello-world
source:
location: 'https://github.com/che-samples/python-hello-world.git'
type: git
branch: master
components:
- type: chePlugin
reference: 'https://raw.githubusercontent.com/radon-h2020/radon-plugin-registry/master/radon/radon-defect-predictor/latest/meta.yaml'
alias: radon-dpt
The Eclipse docs says "To repackage a VS Code extension as a Che-Theia plug-in with its own set of dependencies, package the dependencies into a container."
Containers can be added in the chePlugin reference's metadata under the spec
keyword:
spec:
containers:
- image:
memoryLimit:
memoryRequest:
cpuLimit:
cpuRequest:
Therefore, my plugin's metadata (meta.yaml) is as follows:
meta.yaml
apiVersion: v2
publisher: radon
name: radon-defect-predictor
version: 0.0.5
type: VS Code extension
displayName: RADON-h2020 Defect Predictor
title: A Defect Predictor for Infrastructure-as-Code by RADON
description: A customized extension for analyzing the defectiveness of IaC blueprints
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
repository: https://github.com/radon-h2020/radon-defect-prediction-plugin
category: Other
spec:
containers:
- image: stefadp/radon-dpt-plugin
extensions:
- https://raw.githubusercontent.com/radon-h2020/radon-defect-prediction-plugin/master/radon-defect-predictor-0.0.5.vsix
where the image stefadp/radon-dpt-plugin was built upon the following Dockerfile:
Dockerfile
FROM ubuntu:latest
RUN apt-get update
&& apt-get install -y python3-pip python3-dev
&& cd /usr/local/bin
&& ln -s /usr/bin/python3 python
&& pip3 install --upgrade pip
RUN pip3 install ansiblemetrics
However, when I run the workspace in Eclipse Che, I observe the following error:
pulling image "quay.io/eclipse/che-plugin-metadata-broker:v3.4.0"
Successfully pulled image "quay.io/eclipse/che-plugin-metadata-broker:v3.4.0"
Created container
Started container
Starting plugin metadata broker
List of plugins and editors to install
- radon/radon-defect-predictor/0.0.6 - A customized extension for analyzing the defectiveness of IaC blueprints
- eclipse/che-workspace-telemetry-woopra-plugin/0.0.1 - Telemetry plugin to send information to Woopra
- eclipse/che-machine-exec-plugin/7.24.2 - Che Plug-in with che-machine-exec service to provide creation terminal or tasks for Eclipse Che workspace containers.
- eclipse/che-theia/7.24.2 - Eclipse Theia
All plugin metadata has been successfully processed
pulling image "quay.io/eclipse/che-theia-endpoint-runtime-binary:7.24.2"
Successfully pulled image "quay.io/eclipse/che-theia-endpoint-runtime-binary:7.24.2"
Created container
Started container
pulling image "quay.io/eclipse/che-plugin-artifacts-broker:v3.4.0"
Successfully pulled image "quay.io/eclipse/che-plugin-artifacts-broker:v3.4.0"
Created container
Started container
Starting plugin artifacts broker
Cleaning /plugins dir
Processing plugin radon/radon-defect-predictor/0.0.6
Installing plugin extension 1/1
Downloading plugin from https://raw.githubusercontent.com/radon-h2020/radon-plugin-registry/master/radon/radon-defect-predictor/0.0.6/radon-defect-predictor-0.0.6.vsix
Saving log of installed plugins
All plugin artifacts have been successfully downloaded
pulling image "quay.io/eclipse/che-jwtproxy:0.10.0"
Successfully pulled image "quay.io/eclipse/che-jwtproxy:0.10.0"
Created container
Started container
pulling image "stefadp/radon-dpt-plugin"
Successfully pulled image "stefadp/radon-dpt-plugin"
Created container
Started container
pulling image "quay.io/eclipse/che-workspace-telemetry-woopra-plugin:latest"
Successfully pulled image "quay.io/eclipse/che-workspace-telemetry-woopra-plugin:latest"
Created container
Started container
pulling image "quay.io/eclipse/che-machine-exec:7.24.2"
Successfully pulled image "quay.io/eclipse/che-machine-exec:7.24.2"
Created container
Started container
pulling image "quay.io/eclipse/che-theia:7.24.2"
Error: Failed to run the workspace: "The following containers have terminated:
nt0: reason = 'Completed', exit code = 0, message = 'null'"
Do you have any hint?
question from:
https://stackoverflow.com/questions/65919180/how-to-repackage-a-visual-studio-code-extension-into-a-che-theia-plug-in-with-it 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…