From 9c264bec51f9e4e497289e5070783fb3b213d076 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Thu, 8 Aug 2019 12:01:13 +0300 Subject: [PATCH] Introduce CONTRIBUTING.md file. (#41) * Introduce CONTRIBUTION.md file. Signed-off-by: oandriie@redhat.com * Fix typos. Signed-off-by: oandriie@redhat.com * Fix file name, address requested changes. Signed-off-by: oandriie@redhat.com * Fix up. Signed-off-by: oandriie@redhat.com --- CONTRIBUTING.md | 83 ++++++++++++++++++++++++++++++++++++++ devfile.yaml | 1 - dockerfiles/ci/Dockerfile | 2 + dockerfiles/dev/Dockerfile | 2 + 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..cc5f19cb4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,83 @@ +### Recommended development flow + +The most natural way to develop che-machine-exec is using Eclipse CHE workspace. +To install Eclipse CHE you need to choose infrastructure(openshift, kubernetes) +and [set up it](https://www.eclipse.org/che/docs/che-7/che-quick-starts.html#setting-up-a-local-kubernetes-or-openshift-cluster). +To create development Eclipse CHE workspace we provide che-machine-exec devfile [devfile.yaml](devfile.yaml). +> See more about [devfile](https://redhat-developer.github.io/devfile) + +### Create Eclipse CHE workspace from devfile + +To start Eclipse CHE workspace, [install the latest chectl](https://www.eclipse.org/che/docs/che-7/che-quick-starts.html#installing-the-chectl-management-tool) and start new workspace from devfile: + +```shell +$ chectl workspace:start --devfile=https://raw.githubusercontent.com/eclipse/che-machine-exec/master/devfile.yaml +``` + +Open link to the workspace. After workspace start Eclipse CHE editor +clones che-machine-exec source code to the folder `/projects/src/github.com/eclipse/che-machine-exec`. +This source code available inside development linux containers with names `dev` and `theia-dev`. + +#### 'dev' container target + +che-machine-exec is written on the programming language golang, that's why development container `dev` contains +pre-installed golang binaries to be able to compile, test and launch che-machine-exec binary. +Also `dev` container contains pre-installed `dep` tool to manage golang dependencies. + +> See more: [Dockerfile](dockerfiles/dev/Dockerfile) for `dev` container image . + +#### 'theia-dev' container target + +To test che-machine-exec with ui-part you can use [che-theia](https://github.com/eclipse/che-theia.git). +In this case you need compile che-theia inside development container `theia-dev`. +See more: [che-theia develompent flow](https://github.com/eclipse/che-theia/blob/master/CONTRIBUTING.md). + +### Development commands + +devfile.yaml provides development `tasks` for Eclipse CHE workspace. +List development tasks defined in the devfile `commands` section. + +To launch development commands in the Eclipse CHE workspace there are three ways: + +1. `My Workspace` panel. In this panel you can find development tasks and launch them by click. + +2. `Run task...` menu: click `Terminal` menu in the main toolbar => click `Run task...` menu => select task by name and click it. +> Notice: also you can find menu `Run task...` using command palette. Type shortcut `Ctrl/Cmd + Shift + P` to call command palette, type `run task`. + +3. Manually type task content in the terminal: `Terminal` => `Open Terminal in specific container` => select container with name `dev` and click Enter. +> Notice: use correct working dir for commands in the terminal. + +#### Compilation che-machine-exec + +To compile che-machine-exec binary use task with name `compile`. +This task uses shell script [compile.sh](compile.sh). + +#### Run tests + +To launch che-machine-exec tests use task with name `test`. + +#### Format code + +During development don't forget to format code. +To format che-machine-exec code use task with name `format`. + +#### Update golang dependencies + +To manage che-machine-exec golang dependencies we are using [dep tool](https://golang.github.io/dep). +List dependencies stored in the [Gopkg.toml](Gopkg.toml). To change dependencies you need modify this file. +Use task with name `update dependencies` to flash Gopkg.toml changes: +this task call dep tool to synchronize `vendor` folder and [Gopkg.lock](Gopkg.lock) with updated list dependencies. + +> Notice: `Gopkg.lock and vendor folder` changes should be contributed too. + +#### Start che-machine-exec server + +To start che-machine-exec server you need [compile che-machine-exec](#compilation-che-machine-exec) +and start the server using `start exec server` task. +che-machine-exec server will be started by internal url: 0.0.0.0:5555 +inside `dev` container. To find exposed route link you can use `My Workspace` panel. +For communication with che-machine-exec use websocket protocol. + +#### Stop che-machine-exec server + +To stop che-machine-exec server you can use task with name `kill exec server`. diff --git a/devfile.yaml b/devfile.yaml index db81c6e7e..9b0434ae8 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -86,4 +86,3 @@ commands: - type: exec component: dev command: ps aux | grep "[.]/che-machine-exec" | head -1 | cut -d " " -f 2 | xargs kill - workdir: /projects/src/github.com/eclipse/che-machine-exec diff --git a/dockerfiles/ci/Dockerfile b/dockerfiles/ci/Dockerfile index 3a271dfa4..953c6eede 100644 --- a/dockerfiles/ci/Dockerfile +++ b/dockerfiles/ci/Dockerfile @@ -9,6 +9,8 @@ # Contributors: # Red Hat, Inc. - initial API and implementation # +# Dockerfile defines che-machine-exec production image eclipse/che-machine-exec-dev +# FROM golang:1.10.3-alpine as builder WORKDIR /go/src/github.com/eclipse/che-machine-exec/ diff --git a/dockerfiles/dev/Dockerfile b/dockerfiles/dev/Dockerfile index 8e1d2c2db..2a6385354 100644 --- a/dockerfiles/dev/Dockerfile +++ b/dockerfiles/dev/Dockerfile @@ -9,6 +9,8 @@ # Contributors: # Red Hat, Inc. - initial API and implementation # +# Dockerfile defines che-machine-exec development image eclipse/che-machine-exec-dev +# FROM golang:1.10.3-alpine