Skip to content

Commit

Permalink
Implement agreed-on devfile 2.0 issues (#35)
Browse files Browse the repository at this point in the history
* Implement agreement on issue #18
* Implement agreement on issue #17
* Implement agreement on issue #21
* Implement agreement on issue #22
* Implement agreement on issue #27
* Implement agreement on issue #9
* Implement agreement on issue #10
* Fix PR comments about issue #9 PR comment #35 (comment)
* Fix PR comments about issue #17 PR comment #35 (comment)
* Implement agreement on issue #14 and  #19
* Add the spring boot example
* Implement agreement on issue #32
* Fix last PR comments

Signed-off-by: David Festal <dfestal@redhat.com>

Co-Authored-By: Sergii Leshchenko <sleshche@redhat.com>
  • Loading branch information
davidfestal and sleshchenko authored Apr 22, 2020
1 parent e023a38 commit f9e7352
Show file tree
Hide file tree
Showing 29 changed files with 2,117 additions and 287 deletions.
276 changes: 247 additions & 29 deletions deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml

Large diffs are not rendered by default.

272 changes: 244 additions & 28 deletions deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion devfile-support/samples/custom-devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "my-devfile"
schemaVersion: "2.0.0-beta"
metadata:
name: "my-devfile"
projects:
- name: "my-project"
custom:
Expand All @@ -8,6 +9,7 @@ projects:
custom-info: "connexion-information"
components:
- kubernetes:
name: "production"
url: "https://somewhere/production-environment.yaml"
- custom:
componentClass: "NewComponentType"
Expand Down
26 changes: 17 additions & 9 deletions devfile-support/samples/nodejs-stack.devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
schemaVersion: 2.0.0
name: nodejs-stack
metadata:
name: nodejs-stack
projects:
- name: project
git:
Expand Down Expand Up @@ -30,29 +31,36 @@ components:
mountSources: true
commands:
- exec:
alias: download dependencies
id: download dependencies
component: nodejs
commandLine: npm install
workdir: ${CHE_PROJECTS_ROOT}/project/app
workingDir: ${PROJECTS_ROOT}/project/app
group:
kind: build
- exec:
alias: run the app
id: run the app
component: nodejs
commandLine: nodemon app.js
workdir: ${CHE_PROJECTS_ROOT}/project/app
workingDir: ${PROJECTS_ROOT}/project/app
group:
kind: run
isDefault: true
- exec:
alias: run the app (debugging enabled)
id: run the app (debugging enabled)
component: nodejs
commandLine: nodemon --inspect app.js
workdir: ${CHE_PROJECTS_ROOT}/project/app
workingDir: ${PROJECTS_ROOT}/project/app
group:
kind: run
- exec:
alias: stop the app
id: stop the app
component: nodejs
commandLine: >-
node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr "\\n" " ") &&
echo "Stopping node server with PIDs: ${node_server_pids}" &&
kill -15 ${node_server_pids} &>/dev/null && echo 'Done.'
- vscodeLaunch:
alias: Attach remote debugger
id: Attach remote debugger
inlined: |
{
"version": "0.2.0",
Expand Down
4 changes: 3 additions & 1 deletion devfile-support/samples/sample-devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "devfile example"
schemaVersion: "2.0.0"
metadata:
name: "devfile example"
projects:
- name: "my-project"
custom:
Expand Down Expand Up @@ -37,4 +38,5 @@ components:
field2: ""
name: "myNewComponent"
- kubernetes:
name: "production"
url: "https://somewhere/production-environment.yaml"
27 changes: 23 additions & 4 deletions devfile-support/samples/simple-devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
name: "myDevile"
schemaVersion: "2.0.0"
metadata:
name: "myDevile"
version: "0.0.1"
projects:
- name: "devworkspace-spec"
git:
location: "https://github.com/che-incubator/devworkspace-api"
branch: "master"
commands:
- exec:
id: buildSchema
label: Build the schema
commandLine: "./buildSchema.sh"
component: build-tools
alias: buildSchema
group:
kind: build
isDefault: true
- vscodeTask:
alias: openDevfile
id: openDevfile
inlined:
json
- composite:
id: buildSchemaAndOpenDevfile
Label: Build schema and open devfile
commands:
- buildSchema
- openDevfile
parallel: false
- exec:
id: helloWorld
env:
- name: "USER"
value: "John Doe"
commandLine: 'echo "Hello ${USER}"'
- custom:
id: myCustomCommand
commandClass: myCommandType
embeddedResource:
myEmbeddedObject:
label: My very own and special command
events:
postStart:
- "buildSchemaAndOpenDevfile"
components:
- chePlugin:
registry:
Expand All @@ -38,4 +55,6 @@ components:
registryUrl: "external-registry-url"
- container:
image: some container image with required build tools
name: "build-tools"
mountSources: true
sourceMapping: /home/src
name: "build-tools"
99 changes: 99 additions & 0 deletions devfile-support/samples/spring-boot-http-booster-devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
schemaVersion: 2.0.0
metadata:
name: spring-boot-http-booster
projects:
- name: spring-boot-http-booster
git:
location: https://github.com/snowdrop/spring-boot-http-booster
branch: master
components:
- chePlugin:
registryEntry:
id: redhat/java8/latest
- chePlugin:
registryEntry:
id: redhat/dependency-analytics/latest
- container:
name: maven
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
mountSources: true
memoryLimit: 768Mi
env:
- name: JAVA_OPTS
value: >-
-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss
- name: MAVEN_OPTS
value: $(JAVA_OPTS)
endpoints:
- name: 8080-tcp
targetPort: 8080
configuration:
public: true
volumeMounts:
- name: m2
path: /home/jboss/.m2
- volume:
name: m2
size: 2G
commands:
- exec:
id: build
component: maven
commandLine: mvn -Duser.home=${HOME} -DskipTests clean install
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
env:
- name: MAVEN_OPTS
value: "-Xmx200m"
- vscodeLaunch:
id: debug remote java application
inlined: |
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Attach) - Remote",
"request": "attach",
"hostName": "localhost",
"port": 8000
}]
}
- exec:
id: run
component: maven
commandLine: 'mvn -Duser.home=${HOME} spring-boot:run'
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
env:
- name: MAVEN_OPTS
value: "-Xmx200m"
- exec:
id: debug
component: maven
commandLine: >-
mvn -Duser.home=${HOME} spring-boot:run -Drun.jvmArguments="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
- exec:
id: test
component: maven
commandLine: 'mvn -Duser.home=${HOME} verify'
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
env:
- name: MAVEN_OPTS
value: "-Xmx200m"
- exec:
id: dependency-analysis
component: maven
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
commandLine: >-
${HOME}/stack-analysis.sh -f
${PROJECTS_ROOT}/spring-boot-http-booster/pom.xml -p
${PROJECTS_ROOT}/spring-boot-http-booster
- exec:
id: deploy to OpenShift
component: maven
commandLine: 'mvn fabric8:deploy -Popenshift -DskipTests'
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: 1.0.0
metadata:
name: spring-boot-http-booster
projects:
- name: spring-boot-http-booster
source:
location: 'https://github.com/snowdrop/spring-boot-http-booster'
type: git
branch: master
components:
- id: redhat/java8/latest
type: chePlugin
- id: redhat/dependency-analytics/latest
type: chePlugin
- type: dockerimage
alias: maven
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
mountSources: true
memoryLimit: 768Mi
env:
- value: >-
-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss
name: JAVA_OPTS
- value: $(JAVA_OPTS)
name: MAVEN_OPTS
endpoints:
- name: 8080-tcp
port: 8080
volumes:
- name: m2
containerPath: /home/jboss/.m2
commands:
- name: build
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: >-
MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} -DskipTests clean
install
component: maven
- name: Debug remote java application
actions:
- referenceContent: |
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Attach) - Remote",
"request": "attach",
"hostName": "localhost",
"port": 8000
}]
}
type: vscode-launch
- name: run
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: 'MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} spring-boot:run'
component: maven
- name: debug
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: >-
mvn -Duser.home=${HOME} spring-boot:run -Drun.jvmArguments="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
component: maven
- name: test
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: 'MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} verify'
component: maven
- name: dependency-analysis
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: >-
${HOME}/stack-analysis.sh -f
${PROJECTS_ROOT}/spring-boot-http-booster/pom.xml -p
${PROJECTS_ROOT}/spring-boot-http-booster
component: maven
- name: deploy to OpenShift
actions:
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
type: exec
command: 'mvn fabric8:deploy -Popenshift -DskipTests'
component: maven
4 changes: 3 additions & 1 deletion devfile-support/samples/with-nodejs-parent.devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: with-parent
schemaVersion: 2.0.0
metadata:
name: with-parent
parent:
uri: https://raw.githubusercontent.com/che-incubator/devworkspace-api/proposal-25-variant-1-define-stacks/devfile-support/samples/nodejs-stack.devfile.yaml
commands:
- exec:
id: sayHello
label: Say Hello
commandLine: echo "hello"
component: nodejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"op": "add",
"path": "/properties/metadata",
"value": { "type": "object", "description": "Optional metadata", "properties": {} }
},
{
"op": "add",
"path": "/properties/metadata/properties/version",
"value": { "type": "string", "description": "Optional semver-compatible version", "pattern": "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\-[0-9a-z-]+(\\.[0-9a-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$" }
},
{
"op": "add",
"path": "/properties/metadata/properties/name",
"value": { "type": "string", "description": "Optional devfile name" }
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
"path": "/description",
"value": "Devfile schema."
},
{
"op": "add",
"path": "/properties/name",
"value": { "type": "string", "description": "devfile name" }
},
{
"op": "add",
"path": "/properties/schemaVersion",
Expand All @@ -17,6 +12,6 @@
{
"op": "add",
"path": "/required",
"value": [ "name", "schemaVersion" ]
"value": [ "schemaVersion" ]
}
]
Loading

0 comments on commit f9e7352

Please sign in to comment.