Skip to content

Commit f9e7352

Browse files
Implement agreed-on devfile 2.0 issues (#35)
* 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 <[email protected]> Co-Authored-By: Sergii Leshchenko <[email protected]>
1 parent e023a38 commit f9e7352

29 files changed

+2117
-287
lines changed

deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml

+247-29
Large diffs are not rendered by default.

deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml

+244-28
Large diffs are not rendered by default.

devfile-support/samples/custom-devfile.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
name: "my-devfile"
21
schemaVersion: "2.0.0-beta"
2+
metadata:
3+
name: "my-devfile"
34
projects:
45
- name: "my-project"
56
custom:
@@ -8,6 +9,7 @@ projects:
89
custom-info: "connexion-information"
910
components:
1011
- kubernetes:
12+
name: "production"
1113
url: "https://somewhere/production-environment.yaml"
1214
- custom:
1315
componentClass: "NewComponentType"

devfile-support/samples/nodejs-stack.devfile.yaml

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
schemaVersion: 2.0.0
2-
name: nodejs-stack
2+
metadata:
3+
name: nodejs-stack
34
projects:
45
- name: project
56
git:
@@ -30,29 +31,36 @@ components:
3031
mountSources: true
3132
commands:
3233
- exec:
33-
alias: download dependencies
34+
id: download dependencies
3435
component: nodejs
3536
commandLine: npm install
36-
workdir: ${CHE_PROJECTS_ROOT}/project/app
37+
workingDir: ${PROJECTS_ROOT}/project/app
38+
group:
39+
kind: build
3740
- exec:
38-
alias: run the app
41+
id: run the app
3942
component: nodejs
4043
commandLine: nodemon app.js
41-
workdir: ${CHE_PROJECTS_ROOT}/project/app
44+
workingDir: ${PROJECTS_ROOT}/project/app
45+
group:
46+
kind: run
47+
isDefault: true
4248
- exec:
43-
alias: run the app (debugging enabled)
49+
id: run the app (debugging enabled)
4450
component: nodejs
4551
commandLine: nodemon --inspect app.js
46-
workdir: ${CHE_PROJECTS_ROOT}/project/app
52+
workingDir: ${PROJECTS_ROOT}/project/app
53+
group:
54+
kind: run
4755
- exec:
48-
alias: stop the app
56+
id: stop the app
4957
component: nodejs
5058
commandLine: >-
5159
node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr "\\n" " ") &&
5260
echo "Stopping node server with PIDs: ${node_server_pids}" &&
5361
kill -15 ${node_server_pids} &>/dev/null && echo 'Done.'
5462
- vscodeLaunch:
55-
alias: Attach remote debugger
63+
id: Attach remote debugger
5664
inlined: |
5765
{
5866
"version": "0.2.0",

devfile-support/samples/sample-devfile.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
name: "devfile example"
21
schemaVersion: "2.0.0"
2+
metadata:
3+
name: "devfile example"
34
projects:
45
- name: "my-project"
56
custom:
@@ -37,4 +38,5 @@ components:
3738
field2: ""
3839
name: "myNewComponent"
3940
- kubernetes:
41+
name: "production"
4042
url: "https://somewhere/production-environment.yaml"

devfile-support/samples/simple-devfile.yaml

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
1-
name: "myDevile"
21
schemaVersion: "2.0.0"
2+
metadata:
3+
name: "myDevile"
4+
version: "0.0.1"
35
projects:
46
- name: "devworkspace-spec"
57
git:
68
location: "https://github.com/che-incubator/devworkspace-api"
79
branch: "master"
810
commands:
911
- exec:
12+
id: buildSchema
13+
label: Build the schema
1014
commandLine: "./buildSchema.sh"
1115
component: build-tools
12-
alias: buildSchema
16+
group:
17+
kind: build
18+
isDefault: true
1319
- vscodeTask:
14-
alias: openDevfile
20+
id: openDevfile
1521
inlined:
1622
json
1723
- composite:
24+
id: buildSchemaAndOpenDevfile
1825
Label: Build schema and open devfile
1926
commands:
2027
- buildSchema
2128
- openDevfile
2229
parallel: false
30+
- exec:
31+
id: helloWorld
32+
env:
33+
- name: "USER"
34+
value: "John Doe"
35+
commandLine: 'echo "Hello ${USER}"'
2336
- custom:
37+
id: myCustomCommand
2438
commandClass: myCommandType
2539
embeddedResource:
2640
myEmbeddedObject:
2741
label: My very own and special command
42+
events:
43+
postStart:
44+
- "buildSchemaAndOpenDevfile"
2845
components:
2946
- chePlugin:
3047
registry:
@@ -38,4 +55,6 @@ components:
3855
registryUrl: "external-registry-url"
3956
- container:
4057
image: some container image with required build tools
41-
name: "build-tools"
58+
mountSources: true
59+
sourceMapping: /home/src
60+
name: "build-tools"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
schemaVersion: 2.0.0
2+
metadata:
3+
name: spring-boot-http-booster
4+
projects:
5+
- name: spring-boot-http-booster
6+
git:
7+
location: https://github.com/snowdrop/spring-boot-http-booster
8+
branch: master
9+
components:
10+
- chePlugin:
11+
registryEntry:
12+
id: redhat/java8/latest
13+
- chePlugin:
14+
registryEntry:
15+
id: redhat/dependency-analytics/latest
16+
- container:
17+
name: maven
18+
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
19+
mountSources: true
20+
memoryLimit: 768Mi
21+
env:
22+
- name: JAVA_OPTS
23+
value: >-
24+
-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
25+
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
26+
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
27+
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss
28+
- name: MAVEN_OPTS
29+
value: $(JAVA_OPTS)
30+
endpoints:
31+
- name: 8080-tcp
32+
targetPort: 8080
33+
configuration:
34+
public: true
35+
volumeMounts:
36+
- name: m2
37+
path: /home/jboss/.m2
38+
- volume:
39+
name: m2
40+
size: 2G
41+
commands:
42+
- exec:
43+
id: build
44+
component: maven
45+
commandLine: mvn -Duser.home=${HOME} -DskipTests clean install
46+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
47+
env:
48+
- name: MAVEN_OPTS
49+
value: "-Xmx200m"
50+
- vscodeLaunch:
51+
id: debug remote java application
52+
inlined: |
53+
{
54+
"version": "0.2.0",
55+
"configurations": [
56+
{
57+
"type": "java",
58+
"name": "Debug (Attach) - Remote",
59+
"request": "attach",
60+
"hostName": "localhost",
61+
"port": 8000
62+
}]
63+
}
64+
- exec:
65+
id: run
66+
component: maven
67+
commandLine: 'mvn -Duser.home=${HOME} spring-boot:run'
68+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
69+
env:
70+
- name: MAVEN_OPTS
71+
value: "-Xmx200m"
72+
- exec:
73+
id: debug
74+
component: maven
75+
commandLine: >-
76+
mvn -Duser.home=${HOME} spring-boot:run -Drun.jvmArguments="-Xdebug
77+
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
78+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
79+
- exec:
80+
id: test
81+
component: maven
82+
commandLine: 'mvn -Duser.home=${HOME} verify'
83+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
84+
env:
85+
- name: MAVEN_OPTS
86+
value: "-Xmx200m"
87+
- exec:
88+
id: dependency-analysis
89+
component: maven
90+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
91+
commandLine: >-
92+
${HOME}/stack-analysis.sh -f
93+
${PROJECTS_ROOT}/spring-boot-http-booster/pom.xml -p
94+
${PROJECTS_ROOT}/spring-boot-http-booster
95+
- exec:
96+
id: deploy to OpenShift
97+
component: maven
98+
commandLine: 'mvn fabric8:deploy -Popenshift -DskipTests'
99+
workingDir: '${PROJECTS_ROOT}/spring-boot-http-booster'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
apiVersion: 1.0.0
2+
metadata:
3+
name: spring-boot-http-booster
4+
projects:
5+
- name: spring-boot-http-booster
6+
source:
7+
location: 'https://github.com/snowdrop/spring-boot-http-booster'
8+
type: git
9+
branch: master
10+
components:
11+
- id: redhat/java8/latest
12+
type: chePlugin
13+
- id: redhat/dependency-analytics/latest
14+
type: chePlugin
15+
- type: dockerimage
16+
alias: maven
17+
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
18+
mountSources: true
19+
memoryLimit: 768Mi
20+
env:
21+
- value: >-
22+
-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
23+
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
24+
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
25+
-Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss
26+
name: JAVA_OPTS
27+
- value: $(JAVA_OPTS)
28+
name: MAVEN_OPTS
29+
endpoints:
30+
- name: 8080-tcp
31+
port: 8080
32+
volumes:
33+
- name: m2
34+
containerPath: /home/jboss/.m2
35+
commands:
36+
- name: build
37+
actions:
38+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
39+
type: exec
40+
command: >-
41+
MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} -DskipTests clean
42+
install
43+
component: maven
44+
- name: Debug remote java application
45+
actions:
46+
- referenceContent: |
47+
{
48+
"version": "0.2.0",
49+
"configurations": [
50+
{
51+
"type": "java",
52+
"name": "Debug (Attach) - Remote",
53+
"request": "attach",
54+
"hostName": "localhost",
55+
"port": 8000
56+
}]
57+
}
58+
type: vscode-launch
59+
- name: run
60+
actions:
61+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
62+
type: exec
63+
command: 'MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} spring-boot:run'
64+
component: maven
65+
- name: debug
66+
actions:
67+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
68+
type: exec
69+
command: >-
70+
mvn -Duser.home=${HOME} spring-boot:run -Drun.jvmArguments="-Xdebug
71+
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
72+
component: maven
73+
- name: test
74+
actions:
75+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
76+
type: exec
77+
command: 'MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} verify'
78+
component: maven
79+
- name: dependency-analysis
80+
actions:
81+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
82+
type: exec
83+
command: >-
84+
${HOME}/stack-analysis.sh -f
85+
${PROJECTS_ROOT}/spring-boot-http-booster/pom.xml -p
86+
${PROJECTS_ROOT}/spring-boot-http-booster
87+
component: maven
88+
- name: deploy to OpenShift
89+
actions:
90+
- workdir: '${PROJECTS_ROOT}/spring-boot-http-booster'
91+
type: exec
92+
command: 'mvn fabric8:deploy -Popenshift -DskipTests'
93+
component: maven
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: with-parent
21
schemaVersion: 2.0.0
2+
metadata:
3+
name: with-parent
34
parent:
45
uri: https://raw.githubusercontent.com/che-incubator/devworkspace-api/proposal-25-variant-1-define-stacks/devfile-support/samples/nodejs-stack.devfile.yaml
56
commands:
67
- exec:
8+
id: sayHello
79
label: Say Hello
810
commandLine: echo "hello"
911
component: nodejs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"op": "add",
4+
"path": "/properties/metadata",
5+
"value": { "type": "object", "description": "Optional metadata", "properties": {} }
6+
},
7+
{
8+
"op": "add",
9+
"path": "/properties/metadata/properties/version",
10+
"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-]+)*)?$" }
11+
},
12+
{
13+
"op": "add",
14+
"path": "/properties/metadata/properties/name",
15+
"value": { "type": "string", "description": "Optional devfile name" }
16+
}
17+
]

devfile-support/transformation-rules/add-name-and-version.json devfile-support/transformation-rules/add-schemaVersion.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
"path": "/description",
55
"value": "Devfile schema."
66
},
7-
{
8-
"op": "add",
9-
"path": "/properties/name",
10-
"value": { "type": "string", "description": "devfile name" }
11-
},
127
{
138
"op": "add",
149
"path": "/properties/schemaVersion",
@@ -17,6 +12,6 @@
1712
{
1813
"op": "add",
1914
"path": "/required",
20-
"value": [ "name", "schemaVersion" ]
15+
"value": [ "schemaVersion" ]
2116
}
2217
]

0 commit comments

Comments
 (0)