Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Commit

Permalink
Add VSCode extension broker
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Garagatyi <[email protected]>
  • Loading branch information
Oleksandr Garagatyi committed Dec 11, 2018
1 parent eb9ba03 commit 946fc62
Show file tree
Hide file tree
Showing 10 changed files with 673 additions and 6 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Ignore binaries with these names but not folders with the same names
*/che-plugin-broker/che-plugin-broker
*/theia-plugin-broker/theia-plugin-broker
*/vscode-extension-broker/cmd/vscode-extension-broker
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Ignore binaries with these names but not folders with the same names
che-plugin-broker
theia-plugin-broker
vscode-extension-broker
!che-plugin-broker/
!theia-plugin-broker/

Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ script:
- go test -v -race ./... # Run all the tests with the race detector enabled
- cd brokers/che-plugin-broker; CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -installsuffix cgo -o che-plugin-broker main.go
- cd brokers/theia-plugin-broker; CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -installsuffix cgo -o theia-plugin-broker main.go
- cd brokers/vscode/cmd; CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -installsuffix cgo -o vscode-extension-broker main.go
notifications:
email: false
26 changes: 26 additions & 0 deletions Dockerfile.veb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright (c) 2012-2018 Red Hat, Inc.
\# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates
RUN adduser -D -g '' appuser
WORKDIR /go/src/github.com/eclipse/che-plugin-broker/brokers/vscode/cmd/
COPY . /go/src/github.com/eclipse/che-plugin-broker/
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -installsuffix cgo -o vscode-extension-broker main.go


FROM alpine:3.7
USER appuser
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/github.com/eclipse/che-plugin-broker/brokers/vscode/cmd/vscode-extension-broker /
ENTRYPOINT ["/vscode-extension-broker"]
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This repo contains implmentations of several Che plugin brokers
## This repo contains implmentations of several Che plugin brokers

### che-plugin-broker
# che-plugin-broker
Downloads tar.gz archive and:
- Cleanups content of /plugins/ folder
- Evaluates Che workspace sidecars config from che-plugin.yaml located in a plugin archive and data
from config.json that is placed in workdir or different path if a corresponding broker argument is used.
It contains data about Che plugin or editor from meta.yaml
- Copies dependency file/folder specified in dependencies.yaml inside of a plugin archive

### theia-plugin-broker
# theia-plugin-broker
Downloads .theia archive and:
- Unzip it to a temp folder
- Check content of package.json file in it. If it contains {"engines.cheRuntimeContainer"}
Expand All @@ -27,7 +27,24 @@ plugin is considered non-remote
`THEIA_PLUGIN_ENDPOINT_PORT` and value `port`
- Evaluates Che workspace sidecar config for running Theia plugin as Che remote plugin in a sidecar

### Development
# vscode-extension-broker
Downloads VS Code extension from marketplace and:
- Unzip it to a temp folder
- Check content of package.json file in it.
- Copies unzipped extension to /plugins/
- Sends following sidecar config to Che workspace master:
- with projects volume
- with plugin volume
- adds an endpoint with random port between 4000 and 6000 and name `port<port>`
- adds env var to workspace-wide env vars with name
`THEIA_PLUGIN_REMOTE_ENDPOINT_<plugin_publisher_and_name from package.json>` and value
`ws://port<port>:<port>`
- adds env var to sidecar env vars with name
`THEIA_PLUGIN_ENDPOINT_PORT` and value `port`
- Evaluates Che workspace sidecar config for running VS Code extension as Che Theia remote plugin in a sidecar


# Development
## Build
- build all the code:
```shell
Expand All @@ -41,6 +58,10 @@ CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo -o c
```shell
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo -o theia-plugin-broker brokers/theia-plugin-broker/main.go
```
- build VS Code extension broker binary:
```shell
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo -o vscode-extension-broker brokers/vscode/cmd/main.go
```
- run tests:
```shell
go test -v -race ./...
Expand Down Expand Up @@ -68,5 +89,9 @@ docker build -t eclipse/che-plugin-broker:latest -f Dockerfile.cpb .
```
- build Theia plugin broker
```shell
docker build -t eclipse/theia-plugin-broker:latest -f Dockerfile.tpb .
```
docker build -t eclipse/che-theia-plugin-broker:latest -f Dockerfile.tpb .
```
- build VS Code extension broker
```shell
docker build -t eclipse/che-vscode-extension-broker:latest -f Dockerfile.veb .
```
Loading

0 comments on commit 946fc62

Please sign in to comment.