Giter Site home page Giter Site logo

che-plugin-broker's Introduction

CircleCI

codecov

This repo contains implementations of several Che plugin brokers

init-plugin-broker

Cleanups content of /plugins/ folder. Should be started before other brokers not to remove files they are adding to plugins folder.

unified-plugin-broker

Which can process plugins of types:

  • Che Plugin
  • VS Code extension
  • Che Editor
  • Theia plugin

But it ignores case of plugin type, so any other variants of the same type but with different case of letters is considered the same.

What it actually does:

All plugin/editor types

  • Downloads meta.yaml of a plugin or editor from Che plugin registry
  • Evaluates Che workspace sidecars config from the above mentioned meta.yaml

Theia plugin/VS Code extension

  • Downloads .theia and/or vsix archives and
  • If meta.spec contains containers field with a container definition extension/plugin is considered remote. Otherwise it is considered local
  • For the local plugin case, copies plugin or extension archives to /plugins
  • For the remote plugin case:
    • Copies plugin or extension archives to /plugins/sidecars/<unique plugin name>/
    • Evaluates Che workspace sidecar config for running VS Code or Theia extensions/plugins as Che Theia remote plugins in a sidecar:
      • with projects volume
      • with plugins volume
      • adds env var to sidecar env vars with name THEIA_PLUGINS and value local-dir:///plugins/sidecars/<unique plugin name>
      • only if some plugins might live in a distinct host as the Theia instance (when UseLocalHostInPluginsUrls is False):
        • adds an endpoint with random port between 4000 and 10000 and a random name
        • adds env var to sidecar env vars with name THEIA_PLUGIN_ENDPOINT_PORT and value <endpoint port>
        • adds env var to workspace-wide env vars with name THEIA_PLUGIN_REMOTE_ENDPOINT_<unique_plugin_name> and value ws://<endpoint name>:<endpoint port>
  • Sends sidecar config to Che workspace master

Development

Mocks are generated from interfaces using library mockery To add new mock implementation for an interface or regenerate to an existing one use following command when current dir is location of the folder containing the interface:

mockery -name=NameOfAnInterfaceToMock

Build

  • build all the code:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo ./...
  • build Init plugin broker binary:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo -o init-plugin-broker brokers/init/cmd/main.go
  • build Unified plugin broker binary:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -a -installsuffix cgo -o unified-plugin-broker brokers/unified/cmd/main.go

Run checks

  • run tests:
go test -v -race ./...
  • run linters:
golangci-lint run -v
  • run CI checks locally in Docker (includes build/test/linters):
docker build -f build/CI/Dockerfile .

Check brokers locally

Prerequisites:

- Folder /plugins exists on the host and writable for the user
  • Go to a broker cmd directory, e.g. brokers/unified/cmd
  • Compile binaries go build main.go
  • Run binary ./main -disable-push -runtime-id wsId:env:ownerId
  • Check JSON with sidecar configuration in the very bottom of the output
  • Check that needed files are in /plugins
  • To cleanup /plugins folder init broker can be used

Dependencies

Dependencies in the project are managed by Go Dep. After you added a dependency you need to run the following command to download dependencies to vendor repo and lock file and then commit changes:

dep ensure

dep ensure doesn't automatically change Gopkg.toml which contains dependencies constrants. So, when a dependency is introduced or changed it should be reflected in Gopkg.toml.

Build of Docker images

  • build Init plugin broker
docker build -t eclipse/che-init-plugin-broker:latest -f build/init/Dockerfile .
  • build Unified plugin broker
docker build -t eclipse/che-unified-plugin-broker:latest -f build/unified/Dockerfile .

che-plugin-broker's People

Contributors

amisevsk avatar andrienkoaleksandr avatar davidfestal avatar l0rd avatar metlos avatar monaka avatar mshaposhnik avatar nickboldt avatar skabashnyuk avatar sleshchenko avatar tolusha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.