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

Add support for chefile configuration #1895

Closed
18 of 20 tasks
benoitf opened this issue Jul 21, 2016 · 0 comments
Closed
18 of 20 tasks

Add support for chefile configuration #1895

benoitf opened this issue Jul 21, 2016 · 0 comments
Assignees
Labels
kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed.
Milestone

Comments

@benoitf
Copy link
Contributor

benoitf commented Jul 21, 2016

Here is the idea:

Like for docker or vagrant, we should be able to add a chefile in a directory and then Eclipse Che should be able to create a local folder with all configuration inside this folder.

If I modify locally a file, it will be modified inside che, and if I edit my files inside Eclipse Che it will update the changes on the computer filesystem.

The content of chefile should be scriptable, allowing to use comments and operations/ functions like if () else , for loop, etc (basic scripting operations)

here are list of requirements of chefile

  • defines location of che server, connection details, workspace name
  • allows user to add commands
  • Use context to populate the workspace - files in current directory as project. (.workspace.json, .workspace.dockerfile, .workspace.composefile as override params.)
  • Allows Chefile to use other files instead of .workspace.json. For example, repo could be checked out and it would have a Dockerfile in the root directory. Chefile could be told to use this.
  • should allow location of workspace to be created - either locally, or remotely.

Command are
che dir init
che dir up
che dir down
che dir status

Sample Chefile

# This file can be generated by using `che dir init`
# Defines public IP for Che (ip should be IP of docker host)
che.server.ip = localhost

#Defines port number on which Eclipse Che will listen
che.server.port = 8080

# define ENV property that will be propagated to the che-launcher (and che-server)
# example
# che.server.properties['CHE_VERSION']='4.7'
#che.server.properties['http_proxy']='http://localhost:1234'

# Defines name of the workspace
workspace.name = “happy”

# Defines memory of this workspace
workspace.ram = 2048

# Commands
workspace.commands[0].name = "my-first-command"
workspace.commands[0].type = "mvn"
workspace.commands[0].commandLine = "mvn clean install -f ${current.project.path}"
workspace.commands[0].attributes.previewUrl = "http://${server.port.8080}/${current.project.relpath}"

# type can be omitted as it defaults to custom
workspace.commands[1].name = "my-second-command"
workspace.commands[1].commandLine = "echo hello world"

# post loading actions
# referencing a workspace command
workspace.postload.actions[0].name="my-second-command"
#or by defining on-the-fly a one-line command
workspace.postload.actions[1].script=`echo 'this is a post-loading command' \
                                           && while true; do \
                                           echo $(date); sleep 1; \
                                           done`

JavaScript syntax is authorized in the Chefile
example

var date = new Date();
let es6Date = new Date();

let myMap = new Map();
myMap.set("my-name", "my-custom-workspace");
myMap.set("my-ram", 2048);

console.log('first date is', date);
console.log('another date is', es6Date);

console.log("map is", myMap);

workspace.name=getWorkspaceName();
workspace.ram=myMap.get("my-ram");

console.log('first command of workspace is', workspace.commands[0].commandLine);

function getWorkspaceName() {
   return myMap.get("my-name");
}

list of subtasks

  • Provide codenvy/che-ip to be able to know on which ip the Che is booted (Add docker image to grab the ip used by docker #1891)
  • Introduce codenvy/che-test and codenvy/che-file docker images (Introduce codenvy/che-test and codenvy/che-file docker images #1986)
  • Allow chown warnings for booting docker image (Allow to continue to start the script even if there is a chown failure #1917)
  • If no .che configuration files, provide one automatically
  • Implement che dir down (calls che-launcher:stop)
  • Test che up / down cycle
  • allow to add commands to workspace
  • review formatting of commands in chefile
  • review how to add maven & other attribute-driven pt --> I would need another project type like "configure" + attribute that would be the wanted project-type, then when opening IDE we could ask these attributes
  • configure project as blank instead of 'not configured'
  • respect CHE_VERSION environment variable ** had it set to CHE_VERSION=nightly and then inside the che-file container, it tried to use codenvy/che-ip:latest image, not codenvy/che-ip:nightly.
  • externalize strings of the logger to be configurable with external file
  • handle comments in Chefile (when writing and handle # as allowed comments)
  • allow for che.properties overrides in Chefile - see new syntax
  • add che dir status syntax
  • use uuid for container names to avoid the use of same names when launching several Che in different directories : requires Changes to support che-in-che #2119
  • execute a command after ws load
  • allow to execute a script as post-load action
  • add support for chefile <> factory json compatibility, so that chefiles can be used as factories
  • Get rid of custom che.properties (used for che.user.workspaces.storage and for machine.server.extra.volume) by only using ENV variable to che-launcher

Test scenario - we should be able to git clone the Che repository and then build it + run it with a set of commands. This will require activating privileged mode with a property override.

Current development branch and readme:
https://github.com/eclipse/che/blob/che-files/dockerfiles/che-file/README.md

branch is named che-files

docker image is named codenvy/che-file

@benoitf benoitf added the kind/enhancement A feature request - must adhere to the feature request template. label Jul 21, 2016
@benoitf benoitf self-assigned this Jul 21, 2016
@TylerJewell TylerJewell added kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. status/in-progress This issue has been taken by an engineer and is under active development. team/plugin and removed kind/enhancement A feature request - must adhere to the feature request template. labels Jul 21, 2016
benoitf added a commit that referenced this issue Aug 3, 2016
- Introduce Chefile data with generation and parsing : Allow to customize port number and workspace name for now
- Introduce logger to get same kind of logs than with che-launcher
- Fix documentation
- Improve sh scripts to generate nightly or latest or be started from any directory

Change-Id: I6da278cf1724fbb5a50526a7555e3059477e80fb
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 3, 2016
- Introduce Chefile data with generation and parsing : Allow to customize port number and workspace name for now
- Introduce logger to get same kind of logs than with che-launcher
- Fix documentation
- Improve sh scripts to generate nightly or latest or be started from any directory

Change-Id: I6da278cf1724fbb5a50526a7555e3059477e80fb
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 4, 2016
- Introduce Chefile data with generation and parsing : Allow to customize port number and workspace name for now
- Introduce logger to get same kind of logs than with che-launcher
- Fix documentation
- Improve sh scripts to generate nightly or latest or be started from any directory

Change-Id: I6da278cf1724fbb5a50526a7555e3059477e80fb
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 4, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 4, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 4, 2016
…pace is booted and display that data

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
…pace is booted and display that data

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
example of Chefile content:
workspace.commands[0] = {commandLine : "mvn clean install -f ${current.project.path}", name : "this is my command", type : "mvn", attributes : {previewUrl : "http://${server.port.8080}/${current.project.relpath}"}}
workspace.commands[1] = {commandLine : "echo hello world", name : "this is hello command", type: "custom"}

Change-Id: I38a6e2696610d7750fed57e58afc00baf42ae7ac
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 5, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
…pace is booted and display that data

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
example of Chefile content:
workspace.commands[0] = {commandLine : "mvn clean install -f ${current.project.path}", name : "this is my command", type : "mvn", attributes : {previewUrl : "http://${server.port.8080}/${current.project.relpath}"}}
workspace.commands[1] = {commandLine : "echo hello world", name : "this is hello command", type: "custom"}

Change-Id: I38a6e2696610d7750fed57e58afc00baf42ae7ac
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Change-Id: I978d1c1cad3342e4796fcccb291936f626d1e88a
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 8, 2016
Change-Id: I2cbbac1b7833295be3542a1c5726b434aadf5f7d
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 10, 2016
…generate docker image

Change-Id: Ib86083aaa151fe46de57bb02e8d23eb8d55830bc
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
…nd[0].type = , etc

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
…erties

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
…server is booted (so no need to wait on our own)

Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
benoitf added a commit that referenced this issue Aug 25, 2016
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
@benoitf benoitf removed the status/in-progress This issue has been taken by an engineer and is under active development. label Aug 26, 2016
@benoitf benoitf added this to the 4.7.0 milestone Aug 26, 2016
@bmicklea bmicklea mentioned this issue Aug 29, 2016
89 tasks
JPinkney pushed a commit to JPinkney/che that referenced this issue Aug 17, 2017
- Introduce Chefile data with generation and parsing : Allow to customize port number and workspace name for now
- Introduce logger to get same kind of logs than with che-launcher
- Fix documentation
- Improve sh scripts to generate nightly or latest or be started from any directory

Change-Id: I6da278cf1724fbb5a50526a7555e3059477e80fb
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
JPinkney pushed a commit to JPinkney/che that referenced this issue Aug 17, 2017
* eclipse-che#1895 use static variables
* eclipse-che#1895 allow to customize ram when creating workspace
* eclipse-che#1895 Rework into promise, also start the workspace, check when workspace is booted and display that data
* eclipse-che#1895 Add che down command
* Continue work on eclipse-che#1895 with introducing set of commands for a workspace
example of Chefile content:
workspace.commands[0] = {commandLine : "mvn clean install -f ${current.project.path}", name : "this is my command", type : "mvn", attributes : {previewUrl : "http://${server.port.8080}/${current.project.relpath}"}}
workspace.commands[1] = {commandLine : "echo hello world", name : "this is hello command", type: "custom"}

* eclipse-che#1895 code cleanup
* Fix eclipse-che#1895 Only convert to JSON if it's a JSON object
* Fix issue on eclipse-che#1895 by using all data that can use chunks
* rename chefile to che-dir
* Add bat scripts for eclipse-che#1895 allowing to compile typescript library and generate docker image
* Add on eclipse-che#1895 the ability to execute docker containers by using same image tag than the one being used on the current container
* eclipse-che#1895 : use stderr to write errors and use stdout to write other outputs
* eclipse-che#1895  replace build-docker-image.* by build.* scripts
* eclipse-che#1895 enable decorators support
* - introduce @parameter and @argument decorators to inject command line parameters
- introduce --help/help
- introduce generic class loader for loading test classes
- introduce action and move tests to a dedicated directory
- allow to turn on debug with --logger-debug flag
- introduce user create operation for REST calls

* eclipse-che#1895 : iterate on eth* device to pickup one interface available
* eclipse-che#1895 introduce docker image for actions
* rework start workspace operation to return a promise only updated when workspace is started and also stopWorkspace() is returning promise which only resolve when workspace is stopped
* Add eclipse-che#1895 Introduce Remote calls through JSON Helper class
* Continue eclipse-che#1895 by introducing user and permissions API
Improve error handling
* eclipse-che#1895 change log trace
* eclipse-che#1895 allow to disable prefix log
* eclipse-che#1895 Add actions to add (with option to create it as admin) and remove a user
* eclipse-che#1895 subscribe to web socket before starting workspace
* eclipse-che#1895 handle empty url
* eclipse-che#1895 better http error handling for connection refused
* eclipse-che#1895 handle some error code
* eclipse-che#1895 Add optional --port parameter
* eclipse-che#1895 Remove the lines that start by # in Chefile as it may be comments
* eclipse-che#1895 use auth data login/password if provided without URL
* eclipse-che#1895 drop the use of a binary script to start program
* eclipse-che#1895 allow to avoid to show auth logging
* eclipse-che#1895 use of static constants
* eclipse-che#1895 use of uuid class
* eclipse-che#1895 add new methods to work with workspaces
* eclipse-che#1895 use promise in messages and wait web socket connection is performed
* eclipse-che#1895 allow to call remote commands with an action
* eclipse-che#1895 handle control C
* eclipse-che#1895 allow to write commands with format : command[0].name = , command[0].type = , etc
* eclipse-che#1895 allow to define custom properties to override che launcher properties
* eclipse-che#1895 rework cheboot to be a promise as cheboot script finishes when server is booted (so no need to wait on our own)
* eclipse-che#1895 rework traces
* eclipse-che#1895 handle multiple che up/che down cycle
* eclipse-che#1895 Add che dir status command
* eclipse-che#1895 allow to display custom message based on properties file
* eclipse-che#1895 externalize constants and refactor folder names
* eclipse-che#1895 Use logger for message
* eclipse-che#1895 che.properties file has been moved
* eclipse-che#1895 Allow to execute post-loading commands
* eclipse-che#1895 add debug info
* eclipse-che#1895 add missing commands for windows
* eclipse-che#1895 use Dockerfile from current directory if any
* eclipse-che#1895 reformat strings
* eclipse-che#1895 Change format of Chefile
* eclipse-che#1895 Add --verbose option
* eclipse-che#1895 better error report  when parsing invalid Chefile
* eclipse-che#1895 init unit tests
* eclipse-che#1895 remove runtime
* eclipse-che#1895 set server name with UUID
* eclipse-che#1895 rename che-file to che-dir
* perform chmod on the file to be executable
* eclipse-che#1895 Add support for customizing product name
* eclipse-che#1895 rename post load commands into post load actions
with command and script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed.
Projects
None yet
Development

No branches or pull requests

2 participants