Plugins 如何将VisualStudio代码扩展重新打包到具有自己的依赖项集的Che Theia插件中
我正在尝试将VisualStudio代码扩展重新打包到EclipseChe中,作为Che-Theia插件。 从Ansible文件中提取源代码度量,如下所示: 它通过执行用Python编写的工具的命令行来实现,即必须安装在用户环境中。 因此,我无法将该依赖项添加到VSC扩展的package.json中。相反,用户必须将其安装在EclipseChe工作区上。尽管如此,我希望EclipseChe用户在使用扩展时不需要安装依赖项。一个容器看起来很有用 我有以下Eclipse Che DevFile Eclipse Che DevFilePlugins 如何将VisualStudio代码扩展重新打包到具有自己的依赖项集的Che Theia插件中,plugins,containers,eclipse-che,Plugins,Containers,Eclipse Che,我正在尝试将VisualStudio代码扩展重新打包到EclipseChe中,作为Che-Theia插件。 从Ansible文件中提取源代码度量,如下所示: 它通过执行用Python编写的工具的命令行来实现,即必须安装在用户环境中。 因此,我无法将该依赖项添加到VSC扩展的package.json中。相反,用户必须将其安装在EclipseChe工作区上。尽管如此,我希望EclipseChe用户在使用扩展时不需要安装依赖项。一个容器看起来很有用 我有以下Eclipse Che DevFile E
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
apiVersion:1.0.0
元数据:
名称:python-bd3zh
属性:
持续卷:“false”
项目:
-名称:python hello world
资料来源:
地点:'https://github.com/che-samples/python-hello-world.git'
类型:git
分支机构:硕士
组件:
-类型:chePlugin
参考资料:'https://raw.githubusercontent.com/radon-h2020/radon-plugin-registry/master/radon/radon-defect-predictor/latest/meta.yaml'
别名:radon-dpt
“要将VS代码扩展重新打包为具有自己的依赖项集的Che-Theia插件,请将依赖项打包到容器中。”
容器可以添加到chePlugin引用的元数据中,位于:
spec:
容器:
-图片:
MemoryLit:
memoryRequest:
cpuLimit:
cpuRequest:
因此,我的插件的元数据()如下:
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
其中映像是基于以下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
但是,当我在Eclipse中运行工作区时,我观察到以下错误:
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'"
您有什么提示吗?您必须自定义docker图像才能在sidecar容器中工作。例如,您可以查看已在侧车中的Che中使用的图像: 尝试创建下一个结构:
radon
etc
entrypoint.sh
Dockerfile
entrypoint.sh
的内容是:
#!/bin/sh
set -e
set -x
USER_ID=$(id -u)
export USER_ID
GROUP_ID=$(id -g)
export GROUP_ID
if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi
# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi
exec "$@"
FROM ubuntu:latest
ENV HOME=/home/theia
RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done
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
ADD etc/entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
而Dockerfile
是:
#!/bin/sh
set -e
set -x
USER_ID=$(id -u)
export USER_ID
GROUP_ID=$(id -g)
export GROUP_ID
if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi
# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi
exec "$@"
FROM ubuntu:latest
ENV HOME=/home/theia
RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done
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
ADD etc/entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
然后构建这个Dockerfile并在你的插件中使用它
meta.yaml
嗨,谢谢你的回答,但是它并没有真正的帮助。该源代码解释了如何在Che上发布插件(内置)。我只是想添加我的插件作为第三方。定义meta.yml文件很简单。但是,如果我避免使用依赖项,从而避免使用容器,它就可以正常工作。当我在元数据中添加“containers”部分时出现问题,这是允许的,但我可能遗漏了一些内容。我已经更新了我的评论,希望它能帮助您。非常感谢,这非常有效!请修改您的答案并添加#/在entrypoint.sh的第一行的bin/sh?因此,使用此答案的用户不必面对以下错误:standard_init_linux.go:211:exec用户进程导致的“exec格式错误”