Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove not maintained docker specific code #75

Merged
merged 3 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
87 changes: 1 addition & 86 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 4 additions & 36 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
go-tests = true
unused-packages = true

[[constraint]]
name = "github.com/docker/docker"
version = "=v17.03.2-ce"

[[constraint]]
name = "github.com/eclipse/che-go-jsonrpc"
version = "=0.1.0"
Expand All @@ -44,36 +40,12 @@
name = "github.com/gin-contrib/sse"
revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae"

[[constraint]]
name = "golang.org/x/net"
branch = "1c05540f6879653db88113bc4a2b70aec4bd491f"

# Transitive dependencies.

[[override]]
name = "github.com/Microsoft/go-winio"
version = "=v0.3.8"

[[override]]
name = "github.com/gorilla/websocket"
revision = "361d4c0ffd78338ebe0a9e6320cdbe115d7dc026"

[[override]]
name = "github.com/docker/distribution"
revision = "28602af35aceda2f8d571bad7ca37a54cf0250bc"

[[override]]
name = "github.com/docker/go-connections"
revision = "ecb4cb2dd420ada7df7f2593d6c25441f65f69f2"

[[override]]
name = "github.com/docker/go-units"
revision = "8a7beacffa3009a9ac66bad506b18ffdd110cf97"

[[override]]
name = "github.com/Sirupsen/logrus"
version = "=v0.11.5"

[[override]]
name = "github.com/pkg/errors"
revision = "839d9e913e063e28dfd0e6c7b7512793e0a48be9"
Expand Down Expand Up @@ -145,14 +117,14 @@
name = "golang.org/x/crypto"
revision = "81e90905daefcd6fd217b62423c0908922eadb30"

[[override]]
name = "golang.org/x/net"
revision = "1c05540f6879653db88113bc4a2b70aec4bd491f"

[[override]]
name = "golang.org/x/sys"
revision = "95c6576299259db960f6c5b9b69ea52422860fce"

[[override]]
name = "golang.org/x/net"
revision = "1c05540f6879653db88113bc4a2b70aec4bd491f"

[[override]]
name = "golang.org/x/text"
revision = "b19bf474d317b857955b12035d2c5acb57ce8b01"
Expand Down Expand Up @@ -192,7 +164,3 @@
[[override]]
name = "github.com/golang/protobuf"
version = "=v1.2.0"

[[override]]
name = "github.com/opencontainers/runc"
version = "=v0.1.1"
23 changes: 0 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@ Build docker image with che-machine-exec manually:
docker build --no-cache -t eclipse/che-machine-exec .
```

## Run docker container

Run docker container with che-machine-exec manually:

```bash
docker run --rm -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock eclipse/che-machine-exec
```

## How to use machine-exec image with Eclipse CHE workspace on the docker infrastructure

To configure Eclipse CHE on the docker infrastructure we are using che.env configuration file.
che.env file located in the CHE `data` folder. Edit and save che.env file: apply docker.sock path (by default it's `/var/run/docker.sock`) to the workspace volume property `CHE_WORKSPACE_VOLUME`:

Example:
```bash
CHE_WORKSPACE_VOLUME=/var/run/docker.sock:/var/run/docker.sock;
```
> Notice: all configuration changes become avaliable after restart Eclipse CHE.

## Test che-machine-exec with help UI on the docker infrastructure

Run Eclipse CHE. You can create new Eclipse CHE workspace with integrated Theia IDE from stack 'Theia IDE on docker'. Then you can [test che-machine-exec with help eclipse-che-theia-terminal](#test-che-machine-exec-with-help-eclipse-che-theia-terminal) and [test che-machine-exec with help che-theia-task-plugin](#test-che-machine-exec-with-help-che-theia-task-plugin)

## Test che-machine-exec on the local Openshift

To test che-machine-exec you need deploy Eclipse CHE to the openshift locally. [Prepare Eclipse CHE to deploy](#prepare-eclipse-che-to-deploy)
Expand Down
61 changes: 0 additions & 61 deletions api/model/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@
package model

import (
"fmt"
"io"
"log"

"github.com/docker/docker/api/types"
"github.com/eclipse/che-go-jsonrpc/event"
line_buffer "github.com/eclipse/che-machine-exec/output/line-buffer"
"github.com/eclipse/che-machine-exec/output/utf8stream"
ws_conn "github.com/eclipse/che-machine-exec/ws-conn"
"k8s.io/client-go/tools/remotecommand"
)
Expand Down Expand Up @@ -60,10 +54,6 @@ type MachineExec struct {
// unique client id, real execId should be hidden from client to prevent serialization
ID int `json:"id"`

// Todo Refactoring this code is docker specific. Create separated code layer and move it.
ExecId string
Hjr *types.HijackedResponse

ws_conn.ConnectionHandler

MsgChan chan []byte
Expand Down Expand Up @@ -96,54 +86,3 @@ type ExecErrorEvent struct {
func (*ExecErrorEvent) Type() string {
return OnExecError
}

func (machineExec *MachineExec) Start() {
if machineExec.Hjr == nil {
return
}

go sendClientInputToExec(machineExec)
go sendExecOutputToWebsockets(machineExec)
}

func sendClientInputToExec(machineExec *MachineExec) {
for {
data := <-machineExec.MsgChan
if _, err := machineExec.Hjr.Conn.Write(data); err != nil {
fmt.Println("Failed to write data to exec with id ", machineExec.ID, " Cause: ", err.Error())
return
}
}
}

func sendExecOutputToWebsockets(machineExec *MachineExec) {
hjReader := machineExec.Hjr.Reader
buffer := make([]byte, BufferSize)
filter := &utf8stream.Utf8StreamFilter{}

for {
_, err := hjReader.Read(buffer)
if err != nil {
remainder := filter.FlushBuffer()
if len(remainder) > 0 {
machineExec.Buffer.Write(remainder)
machineExec.WriteDataToWsConnections(remainder)
}

if err == io.EOF {
machineExec.ExitChan <- true
} else {
machineExec.ErrorChan <- err
log.Println("failed to read exec stdOut/stdError stream. " + err.Error())
}
return
}

filteredBuffer := filter.ProcessRaw(buffer)

if len(filteredBuffer) > 0 {
machineExec.Buffer.Write(filteredBuffer)
machineExec.WriteDataToWsConnections(filteredBuffer)
}
}
}
44 changes: 0 additions & 44 deletions client/docker_client_provider.go

This file was deleted.

Loading