diff --git a/deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml b/deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml index 9cdffa122..0735a7e8f 100644 --- a/deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml +++ b/deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml @@ -46,11 +46,11 @@ spec: composite: description: Composite command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commands: description: The commands that comprise this composite @@ -58,38 +58,91 @@ spec: items: type: string type: array + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a + given group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, + or in events. + type: string label: + description: Optional label that provides a label for + this command to be used in Editor UI menus for example type: string parallel: type: boolean + required: + - id type: object custom: description: Custom command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commandClass: type: string embeddedResource: type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a + given group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, + or in events. + type: string label: + description: Optional label that provides a label for + this command to be used in Editor UI menus for example type: string required: - commandClass - embeddedResource + - id type: object exec: description: Exec command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commandLine: description: The actual command-line string @@ -98,14 +151,54 @@ spec: description: Describes component to which given action relates type: string + env: + description: Optional list of environment variables that + have to be set before running the command + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a + given group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, + or in events. + type: string label: + description: Optional label that provides a label for + this command to be used in Editor UI menus for example type: string - workdir: + workingDir: description: Working directory where the command should be executed type: string required: - commandLine + - id type: object type: description: Type of workspace command @@ -118,12 +211,35 @@ spec: vscodeLaunch: description: VscodeLaunch command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a + given group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, + or in events. + type: string inlined: description: Embedded content of the vscode configuration file @@ -134,16 +250,41 @@ spec: url: description: Location as an absolute of relative URL type: string + required: + - id type: object vscodeTask: description: VscodeTask command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a + given group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, + or in events. + type: string inlined: description: Embedded content of the vscode configuration file @@ -154,6 +295,8 @@ spec: url: description: Location as an absolute of relative URL type: string + required: + - id type: object type: object type: array @@ -165,8 +308,6 @@ spec: cheEditor: description: CheEditor component properties: - alias: - type: string locationType: description: Type of plugin location enum: @@ -175,6 +316,11 @@ spec: type: string memoryLimit: type: string + name: + description: Optional name that allows referencing the + component in commands, or inside a parent If omitted + it will be infered from the location (uri or registryEntry) + type: string registryEntry: description: Location of an entry inside a plugin registry properties: @@ -192,8 +338,6 @@ spec: chePlugin: description: ChePlugin component properties: - alias: - type: string locationType: description: Type of plugin location enum: @@ -202,6 +346,11 @@ spec: type: string memoryLimit: type: string + name: + description: Optional name that allows referencing the + component in commands, or inside a parent If omitted + it will be infered from the location (uri or registryEntry) + type: string registryEntry: description: Location of an entry inside a plugin registry properties: @@ -219,8 +368,6 @@ spec: container: description: Container component properties: - alias: - type: string endpoints: items: properties: @@ -267,6 +414,7 @@ spec: type: object type: array env: + description: Environment variables used in this container items: properties: name: @@ -286,22 +434,34 @@ spec: type: boolean name: type: string - volumes: + sourceMapping: + description: Optional specification of the path in the + container where project sources should be transferred/mounted + when `mountSources` is `true`. When omitted, the value + of the `PROJECTS_ROOT` environment variable is used. + type: string + volumeMounts: + description: List of volumes mounts that should be mounted + is this container. items: description: Volume that should be mounted to a component container properties: - mountPath: - type: string name: - description: The volume name. If several components - mount the same volume then they will reuse the - volume and will be able to access to the same - files + description: The volume mount name is the name of + an existing `Volume` component. If no corresponding + `Volume` component exist it is implicitly added. + If several containers mount the same volume name + then they will reuse the same volume and will + be able to access to the same files. + type: string + path: + description: The path in the component container + where the volume should be mounted type: string required: - - mountPath - name + - path type: object type: array required: @@ -325,32 +485,40 @@ spec: kubernetes: description: Kubernetes component properties: - alias: - type: string inlined: description: Reference to the plugin definition type: string locationType: description: Type of Kubernetes-like location type: string + name: + description: Mandatory name that allows referencing the + component in commands, or inside a parent + type: string url: description: Location in a plugin registry type: string + required: + - name type: object openshift: description: Openshift component properties: - alias: - type: string inlined: description: Reference to the plugin definition type: string locationType: description: Type of Kubernetes-like location type: string + name: + description: Mandatory name that allows referencing the + component in commands, or inside a parent + type: string url: description: Location in a plugin registry type: string + required: + - name type: object type: description: Type of project source @@ -359,11 +527,61 @@ spec: - Kubernetes - Openshift - CheEditor + - Volume - ChePlugin - Custom type: string + volume: + description: Volume component + properties: + name: + description: Mandatory name that allows referencing the + Volume component in Container volume mounts or inside + a parent + type: string + size: + description: Size of the volume + type: string + required: + - name + type: object type: object type: array + events: + description: Bindings of commands to events. Each command is referred-to + by its name. + properties: + postStart: + description: Names of commands that should be executed after + the workspace is completely started. In the case of Che-Theia, + these commands should be executed after all plugins and extensions + have started, including project cloning. This means that those + commands are not triggered until the user opens the IDE in + his browser. + items: + type: string + type: array + postStop: + description: Names of commands that should be executed after + stopping the workspace. + items: + type: string + type: array + preStart: + description: Names of commands that should be executed before + the workspace start. Kubernetes-wise, these commands would + typically be executed in init containers of the workspace + POD. + items: + type: string + type: array + preStop: + description: Names of commands that should be executed before + stopping the workspace. + items: + type: string + type: array + type: object parent: description: Parent workspace template properties: diff --git a/deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml b/deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml index f4a8a769b..1605f2db9 100644 --- a/deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml +++ b/deploy/crds/workspaces.ecd.eclipse.org_devworkspacetemplates_crd.yaml @@ -38,49 +38,102 @@ spec: composite: description: Composite command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commands: description: The commands that comprise this composite command items: type: string type: array + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a given + group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, or + in events. + type: string label: + description: Optional label that provides a label for this + command to be used in Editor UI menus for example type: string parallel: type: boolean + required: + - id type: object custom: description: Custom command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commandClass: type: string embeddedResource: type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a given + group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, or + in events. + type: string label: + description: Optional label that provides a label for this + command to be used in Editor UI menus for example type: string required: - commandClass - embeddedResource + - id type: object exec: description: Exec command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object commandLine: description: The actual command-line string @@ -88,14 +141,54 @@ spec: component: description: Describes component to which given action relates type: string + env: + description: Optional list of environment variables that have + to be set before running the command + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a given + group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, or + in events. + type: string label: + description: Optional label that provides a label for this + command to be used in Editor UI menus for example type: string - workdir: + workingDir: description: Working directory where the command should be executed type: string required: - commandLine + - id type: object type: description: Type of workspace command @@ -108,12 +201,35 @@ spec: vscodeLaunch: description: VscodeLaunch command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a given + group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, or + in events. + type: string inlined: description: Embedded content of the vscode configuration file @@ -124,16 +240,41 @@ spec: url: description: Location as an absolute of relative URL type: string + required: + - id type: object vscodeTask: description: VscodeTask command properties: - alias: - type: string attributes: additionalProperties: type: string + description: Optional map of free-form additional command + attributes type: object + group: + description: Defines the group this command is part of + properties: + isDefault: + description: Identifies the default command for a given + group kind + type: boolean + kind: + description: Kind of group the command is part of + enum: + - build + - run + - test + - debug + type: string + required: + - kind + type: object + id: + description: Mandatory identifier that allows referencing + this command in composite commands, or from a parent, or + in events. + type: string inlined: description: Embedded content of the vscode configuration file @@ -144,6 +285,8 @@ spec: url: description: Location as an absolute of relative URL type: string + required: + - id type: object type: object type: array @@ -155,8 +298,6 @@ spec: cheEditor: description: CheEditor component properties: - alias: - type: string locationType: description: Type of plugin location enum: @@ -165,6 +306,11 @@ spec: type: string memoryLimit: type: string + name: + description: Optional name that allows referencing the component + in commands, or inside a parent If omitted it will be infered + from the location (uri or registryEntry) + type: string registryEntry: description: Location of an entry inside a plugin registry properties: @@ -182,8 +328,6 @@ spec: chePlugin: description: ChePlugin component properties: - alias: - type: string locationType: description: Type of plugin location enum: @@ -192,6 +336,11 @@ spec: type: string memoryLimit: type: string + name: + description: Optional name that allows referencing the component + in commands, or inside a parent If omitted it will be infered + from the location (uri or registryEntry) + type: string registryEntry: description: Location of an entry inside a plugin registry properties: @@ -209,8 +358,6 @@ spec: container: description: Container component properties: - alias: - type: string endpoints: items: properties: @@ -257,6 +404,7 @@ spec: type: object type: array env: + description: Environment variables used in this container items: properties: name: @@ -276,21 +424,34 @@ spec: type: boolean name: type: string - volumes: + sourceMapping: + description: Optional specification of the path in the container + where project sources should be transferred/mounted when + `mountSources` is `true`. When omitted, the value of the + `PROJECTS_ROOT` environment variable is used. + type: string + volumeMounts: + description: List of volumes mounts that should be mounted + is this container. items: description: Volume that should be mounted to a component container properties: - mountPath: - type: string name: - description: The volume name. If several components - mount the same volume then they will reuse the volume - and will be able to access to the same files + description: The volume mount name is the name of an + existing `Volume` component. If no corresponding `Volume` + component exist it is implicitly added. If several + containers mount the same volume name then they will + reuse the same volume and will be able to access to + the same files. + type: string + path: + description: The path in the component container where + the volume should be mounted type: string required: - - mountPath - name + - path type: object type: array required: @@ -314,32 +475,40 @@ spec: kubernetes: description: Kubernetes component properties: - alias: - type: string inlined: description: Reference to the plugin definition type: string locationType: description: Type of Kubernetes-like location type: string + name: + description: Mandatory name that allows referencing the component + in commands, or inside a parent + type: string url: description: Location in a plugin registry type: string + required: + - name type: object openshift: description: Openshift component properties: - alias: - type: string inlined: description: Reference to the plugin definition type: string locationType: description: Type of Kubernetes-like location type: string + name: + description: Mandatory name that allows referencing the component + in commands, or inside a parent + type: string url: description: Location in a plugin registry type: string + required: + - name type: object type: description: Type of project source @@ -348,11 +517,58 @@ spec: - Kubernetes - Openshift - CheEditor + - Volume - ChePlugin - Custom type: string + volume: + description: Volume component + properties: + name: + description: Mandatory name that allows referencing the Volume + component in Container volume mounts or inside a parent + type: string + size: + description: Size of the volume + type: string + required: + - name + type: object type: object type: array + events: + description: Bindings of commands to events. Each command is referred-to + by its name. + properties: + postStart: + description: Names of commands that should be executed after the + workspace is completely started. In the case of Che-Theia, these + commands should be executed after all plugins and extensions have + started, including project cloning. This means that those commands + are not triggered until the user opens the IDE in his browser. + items: + type: string + type: array + postStop: + description: Names of commands that should be executed after stopping + the workspace. + items: + type: string + type: array + preStart: + description: Names of commands that should be executed before the + workspace start. Kubernetes-wise, these commands would typically + be executed in init containers of the workspace POD. + items: + type: string + type: array + preStop: + description: Names of commands that should be executed before stopping + the workspace. + items: + type: string + type: array + type: object parent: description: Parent workspace template properties: diff --git a/devfile-support/samples/custom-devfile.yaml b/devfile-support/samples/custom-devfile.yaml index ed6147883..e982121cb 100644 --- a/devfile-support/samples/custom-devfile.yaml +++ b/devfile-support/samples/custom-devfile.yaml @@ -1,5 +1,6 @@ -name: "my-devfile" schemaVersion: "2.0.0-beta" +metadata: + name: "my-devfile" projects: - name: "my-project" custom: @@ -8,6 +9,7 @@ projects: custom-info: "connexion-information" components: - kubernetes: + name: "production" url: "https://somewhere/production-environment.yaml" - custom: componentClass: "NewComponentType" diff --git a/devfile-support/samples/nodejs-stack.devfile.yaml b/devfile-support/samples/nodejs-stack.devfile.yaml index 23343487f..d3acc66c5 100644 --- a/devfile-support/samples/nodejs-stack.devfile.yaml +++ b/devfile-support/samples/nodejs-stack.devfile.yaml @@ -1,5 +1,6 @@ schemaVersion: 2.0.0 -name: nodejs-stack +metadata: + name: nodejs-stack projects: - name: project git: @@ -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", diff --git a/devfile-support/samples/sample-devfile.yaml b/devfile-support/samples/sample-devfile.yaml index 844743c0d..fc401da2f 100644 --- a/devfile-support/samples/sample-devfile.yaml +++ b/devfile-support/samples/sample-devfile.yaml @@ -1,5 +1,6 @@ -name: "devfile example" schemaVersion: "2.0.0" +metadata: + name: "devfile example" projects: - name: "my-project" custom: @@ -37,4 +38,5 @@ components: field2: "" name: "myNewComponent" - kubernetes: + name: "production" url: "https://somewhere/production-environment.yaml" diff --git a/devfile-support/samples/simple-devfile.yaml b/devfile-support/samples/simple-devfile.yaml index cd6a074fa..e05106c61 100644 --- a/devfile-support/samples/simple-devfile.yaml +++ b/devfile-support/samples/simple-devfile.yaml @@ -1,5 +1,7 @@ -name: "myDevile" schemaVersion: "2.0.0" +metadata: + name: "myDevile" + version: "0.0.1" projects: - name: "devworkspace-spec" git: @@ -7,24 +9,39 @@ projects: 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: @@ -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" diff --git a/devfile-support/samples/spring-boot-http-booster-devfile.yaml b/devfile-support/samples/spring-boot-http-booster-devfile.yaml new file mode 100644 index 000000000..8764d46f6 --- /dev/null +++ b/devfile-support/samples/spring-boot-http-booster-devfile.yaml @@ -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' diff --git a/devfile-support/samples/spring-boot-http-booster-devfile.yaml.devfile-1.0.yaml b/devfile-support/samples/spring-boot-http-booster-devfile.yaml.devfile-1.0.yaml new file mode 100644 index 000000000..930dc774c --- /dev/null +++ b/devfile-support/samples/spring-boot-http-booster-devfile.yaml.devfile-1.0.yaml @@ -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 \ No newline at end of file diff --git a/devfile-support/samples/with-nodejs-parent.devfile.yaml b/devfile-support/samples/with-nodejs-parent.devfile.yaml index 6e6b63b11..d89211b3c 100644 --- a/devfile-support/samples/with-nodejs-parent.devfile.yaml +++ b/devfile-support/samples/with-nodejs-parent.devfile.yaml @@ -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 diff --git a/devfile-support/transformation-rules/add-name-and-version-metadata.json b/devfile-support/transformation-rules/add-name-and-version-metadata.json new file mode 100644 index 000000000..313225457 --- /dev/null +++ b/devfile-support/transformation-rules/add-name-and-version-metadata.json @@ -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" } + } +] diff --git a/devfile-support/transformation-rules/add-name-and-version.json b/devfile-support/transformation-rules/add-schemaVersion.json similarity index 70% rename from devfile-support/transformation-rules/add-name-and-version.json rename to devfile-support/transformation-rules/add-schemaVersion.json index 0fed2b807..cb724d2f2 100644 --- a/devfile-support/transformation-rules/add-name-and-version.json +++ b/devfile-support/transformation-rules/add-schemaVersion.json @@ -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", @@ -17,6 +12,6 @@ { "op": "add", "path": "/required", - "value": [ "name", "schemaVersion" ] + "value": [ "schemaVersion" ] } ] diff --git a/pkg/apis/workspaces/v1alpha1/commands.go b/pkg/apis/workspaces/v1alpha1/commands.go index 7e3f15949..e7c4c8759 100644 --- a/pkg/apis/workspaces/v1alpha1/commands.go +++ b/pkg/apis/workspaces/v1alpha1/commands.go @@ -15,14 +15,47 @@ const ( CustomCommandType CommandType = "Custom" ) +// CommandGroupType describes the kind of command group. +// +kubebuilder:validation:Enum=build;run;test;debug +type CommandGroupType string + +const ( + BuildCommandGroupType CommandGroupType = "build" + RunCommandGroupType CommandGroupType = "run" + TestCommandGroupType CommandGroupType = "test" + DebugCommandGroupType CommandGroupType = "debug" +) + +type CommandGroup struct { + // Kind of group the command is part of + Kind CommandGroupType `json:"kind"` + + // +optional + // Identifies the default command for a given group kind + IsDefault bool `json:"isDefault,omitempty"` +} + type BaseCommand struct { - Alias string `json:"alias,omitempty"` - Attributes map[string]string `json:"attributes,omitempty"` // Additional command attributes + // Mandatory identifier that allows referencing + // this command in composite commands, or from + // a parent, or in events. + Id string `json:"id"` + + // +optional + // Defines the group this command is part of + Group *CommandGroup `json:"group,omitempty"` + + // Optional map of free-form additional command attributes + Attributes map[string]string `json:"attributes,omitempty"` } type LabeledCommand struct { BaseCommand `json:",inline"` - Label string `json:"label,omitempty"` + + // +optional + // Optional label that provides a label for this command + // to be used in Editor UI menus for example + Label string `json:"label,omitempty"` } type Command struct { @@ -68,7 +101,12 @@ type ExecCommand struct { Component string `json:"component,omitempty"` // Working directory where the command should be executed - Workdir string `json:"workdir,omitempty"` + WorkingDir string `json:"workingDir,omitempty"` + + // +optional + // Optional list of environment variables that have to be set + // before running the command + Env []EnvVar `json:"env,omitempty"` } type CompositeCommand struct { @@ -100,7 +138,7 @@ type VscodeConfigurationCommandLocation struct { } type VscodeConfigurationCommand struct { - BaseCommand `json:",inline"` + BaseCommand `json:",inline"` VscodeConfigurationCommandLocation `json:",inline"` } diff --git a/pkg/apis/workspaces/v1alpha1/components.go b/pkg/apis/workspaces/v1alpha1/components.go index 6592368b1..9120a2f4d 100644 --- a/pkg/apis/workspaces/v1alpha1/components.go +++ b/pkg/apis/workspaces/v1alpha1/components.go @@ -4,7 +4,7 @@ import runtime "k8s.io/apimachinery/pkg/runtime" // ComponentType describes the type of component. // Only one of the following component type may be specified. -// +kubebuilder:validation:Enum= Container;Kubernetes;Openshift;CheEditor;ChePlugin;Custom +// +kubebuilder:validation:Enum= Container;Kubernetes;Openshift;CheEditor;Volume;ChePlugin;Custom type ComponentType string const ( @@ -13,6 +13,7 @@ const ( OpenshiftComponentType ComponentType = "Openshift" CheEditorComponentType ComponentType = "CheEditor" ChePluginComponentType ComponentType = "ChePlugin" + VolumeComponentType ComponentType = "Volume" CustomComponentType ComponentType = "Custom" ) @@ -21,7 +22,6 @@ const ( // Workspace component: Anything that will bring additional features / tooling / behaviour / context // to the workspace, in order to make working in it easier. type BaseComponent struct { - Alias string `json:"alias,omitempty"` } type Component struct { @@ -41,6 +41,10 @@ type PolymorphicComponent struct { // +optional Container *ContainerComponent `json:"container,omitempty"` + // Volume component + // +optional + Volume *VolumeComponent `json:"volume,omitempty"` + // CheEditor component // +optional CheEditor *CheEditorComponent `json:"cheEditor,omitempty"` diff --git a/pkg/apis/workspaces/v1alpha1/containerComponent.go b/pkg/apis/workspaces/v1alpha1/containerComponent.go index 9d79b40b1..44b22272d 100644 --- a/pkg/apis/workspaces/v1alpha1/containerComponent.go +++ b/pkg/apis/workspaces/v1alpha1/containerComponent.go @@ -2,10 +2,10 @@ package v1alpha1 // Component that allows the developer to add a configured container into his workspace type ContainerComponent struct { - BaseComponent `json:",inline"` - Container `json:",inline"` - MemoryLimit string `json:"memoryLimit,omitempty"` - Endpoints []Endpoint `json:"endpoints,omitempty"` + BaseComponent `json:",inline"` + Container `json:",inline"` + MemoryLimit string `json:"memoryLimit,omitempty"` + Endpoints []Endpoint `json:"endpoints,omitempty"` } type Endpoint struct { @@ -41,16 +41,28 @@ type EndpointConfiguration struct { } type Container struct { - Name string `json:"name"` - Image string `json:"image"` + Name string `json:"name"` + Image string `json:"image"` // +optional - Env []EnvVar `json:"env,omitempty"` + // Environment variables used in this container + Env []EnvVar `json:"env,omitempty"` + // +optional - Volumes []Volume `json:"volumes,omitempty"` + // List of volumes mounts that should be mounted is this container. + VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"` + //+optional - MemoryLimit string `json:"memoryLimit,omitempty"` + MemoryLimit string `json:"memoryLimit,omitempty"` + + //+optional + MountSources bool `json:"mountSources"` + //+optional - MountSources bool `json:"mountSources"` + // + // Optional specification of the path in the container where + // project sources should be transferred/mounted when `mountSources` is `true`. + // When omitted, the value of the `PROJECTS_ROOT` environment variable is used. + SourceMapping string `json:"sourceMapping"` } type EnvVar struct { @@ -59,11 +71,13 @@ type EnvVar struct { } // Volume that should be mounted to a component container -type Volume struct { - // The volume name. - // If several components mount the same volume then they will reuse the volume - // and will be able to access to the same files +type VolumeMount struct { + // The volume mount name is the name of an existing `Volume` component. + // If no corresponding `Volume` component exist it is implicitly added. + // If several containers mount the same volume name + // then they will reuse the same volume and will be able to access to the same files. Name string `json:"name"` - MountPath string `json:"mountPath"` + // The path in the component container where the volume should be mounted + Path string `json:"path"` } diff --git a/pkg/apis/workspaces/v1alpha1/devworkspaceTemplateSpec.go b/pkg/apis/workspaces/v1alpha1/devworkspaceTemplateSpec.go index 80ea50a32..bff14996a 100644 --- a/pkg/apis/workspaces/v1alpha1/devworkspaceTemplateSpec.go +++ b/pkg/apis/workspaces/v1alpha1/devworkspaceTemplateSpec.go @@ -4,16 +4,24 @@ package v1alpha1 // +k8s:openapi-gen=true type DevWorkspaceTemplateSpec struct { // Parent workspace template - Parent *Parent `json:"parent,omitempty"` + // +optional + Parent *Parent `json:"parent,omitempty"` // Predefined, ready-to-use, workspace-related commands - Commands []Command `json:"commands,omitempty"` + // +optional + Commands []Command `json:"commands,omitempty"` + + // Bindings of commands to events. + // Each command is referred-to by its name. + // +optional + Events Events `json:"events,omitempty"` // Projects worked on in the workspace, containing names and sources locations - Projects []Project `json:"projects,omitempty"` - + // +optional + Projects []Project `json:"projects,omitempty"` + // List of the workspace components, such as editor and plugins, // user-provided containers, or other types of components // +optional - Components []Component `json:"components,omitempty"` + Components []Component `json:"components,omitempty"` } diff --git a/pkg/apis/workspaces/v1alpha1/events.go b/pkg/apis/workspaces/v1alpha1/events.go new file mode 100644 index 000000000..4897a4b2c --- /dev/null +++ b/pkg/apis/workspaces/v1alpha1/events.go @@ -0,0 +1,26 @@ +package v1alpha1 + +type Events struct { + WorkspaceEvents `json:",inline"` +} + +type WorkspaceEvents struct { + // Names of commands that should be executed before the workspace start. + // Kubernetes-wise, these commands would typically be executed in init containers of the workspace POD. + // +optional + PreStart []string `json:"preStart,omitempty"` + + // Names of commands that should be executed after the workspace is completely started. + // In the case of Che-Theia, these commands should be executed after all plugins and extensions have started, including project cloning. + // This means that those commands are not triggered until the user opens the IDE in his browser. + // +optional + PostStart []string `json:"postStart,omitempty"` + + // +optional + // Names of commands that should be executed before stopping the workspace. + PreStop []string `json:"preStop,omitempty"` + + // +optional + // Names of commands that should be executed after stopping the workspace. + PostStop []string `json:"postStop,omitempty"` +} diff --git a/pkg/apis/workspaces/v1alpha1/kubernetesLikeComponent.go b/pkg/apis/workspaces/v1alpha1/kubernetesLikeComponent.go index 5f02c7db5..ec3c30527 100644 --- a/pkg/apis/workspaces/v1alpha1/kubernetesLikeComponent.go +++ b/pkg/apis/workspaces/v1alpha1/kubernetesLikeComponent.go @@ -19,8 +19,11 @@ type K8sLikeComponentLocation struct { } type K8sLikeComponent struct { - BaseComponent `json:",inline"` - Location K8sLikeComponentLocation `json:",inline"` + BaseComponent `json:",inline"` + K8sLikeComponentLocation `json:",inline"` + // Mandatory name that allows referencing the component + // in commands, or inside a parent + Name string `json:"name"` } // Component that allows partly importing Kubernetes resources into the workspace POD diff --git a/pkg/apis/workspaces/v1alpha1/pluginLikeComponents.go b/pkg/apis/workspaces/v1alpha1/pluginLikeComponents.go index eb68b7bc2..9f42e9e4c 100644 --- a/pkg/apis/workspaces/v1alpha1/pluginLikeComponents.go +++ b/pkg/apis/workspaces/v1alpha1/pluginLikeComponents.go @@ -1,7 +1,7 @@ package v1alpha1 type RegistryEntryPluginLocation struct { - Id string `json:"id"` + Id string `json:"id"` // +optional BaseUrl string `json:"baseUrl,omitempty"` @@ -13,8 +13,8 @@ type RegistryEntryPluginLocation struct { type PluginLocationType string const ( - RegistryEntryPluginLocationType PluginLocationType = "RegistryEntry" - UriPluginLocationType PluginLocationType = "Uri" + RegistryEntryPluginLocationType PluginLocationType = "RegistryEntry" + UriPluginLocationType PluginLocationType = "Uri" ) // +k8s:openapi-gen=true @@ -37,7 +37,14 @@ type ChePluginLocation struct { type PluginLikeComponent struct { BaseComponent `json:",inline"` - MemoryLimit string `json:"memoryLimit,omitempty"` + + // +optional + // Optional name that allows referencing the component + // in commands, or inside a parent + // If omitted it will be infered from the location (uri or registryEntry) + Name string `json:"name,omitempty"` + + MemoryLimit string `json:"memoryLimit,omitempty"` ChePluginLocation `json:",inline"` } diff --git a/pkg/apis/workspaces/v1alpha1/volumeComponent.go b/pkg/apis/workspaces/v1alpha1/volumeComponent.go new file mode 100644 index 000000000..bb47d4633 --- /dev/null +++ b/pkg/apis/workspaces/v1alpha1/volumeComponent.go @@ -0,0 +1,18 @@ +package v1alpha1 + +// Component that allows the developer to declare and configure a volume into his workspace +type VolumeComponent struct { + BaseComponent `json:",inline"` + Volume `json:",inline"` +} + +// Volume that should be mounted to a component container +type Volume struct { + // Mandatory name that allows referencing the Volume component + // in Container volume mounts or inside a parent + Name string `json:"name"` + + // +optional + // Size of the volume + Size string `json:"size,omitempty"` +} diff --git a/pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go index 3da9b6d9d..bd33afd90 100644 --- a/pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/workspaces/v1alpha1/zz_generated.deepcopy.go @@ -12,6 +12,11 @@ import ( // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BaseCommand) DeepCopyInto(out *BaseCommand) { *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(CommandGroup) + **out = **in + } if in.Attributes != nil { in, out := &in.Attributes, &out.Attributes *out = make(map[string]string, len(*in)) @@ -120,6 +125,22 @@ func (in *Command) DeepCopy() *Command { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommandGroup) DeepCopyInto(out *CommandGroup) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandGroup. +func (in *CommandGroup) DeepCopy() *CommandGroup { + if in == nil { + return nil + } + out := new(CommandGroup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommonProjectSource) DeepCopyInto(out *CommonProjectSource) { *out = *in @@ -183,9 +204,9 @@ func (in *Container) DeepCopyInto(out *Container) { *out = make([]EnvVar, len(*in)) copy(*out, *in) } - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]Volume, len(*in)) + if in.VolumeMounts != nil { + in, out := &in.VolumeMounts, &out.VolumeMounts + *out = make([]VolumeMount, len(*in)) copy(*out, *in) } return @@ -454,6 +475,7 @@ func (in *DevWorkspaceTemplateSpec) DeepCopyInto(out *DevWorkspaceTemplateSpec) (*in)[i].DeepCopyInto(&(*out)[i]) } } + in.Events.DeepCopyInto(&out.Events) if in.Projects != nil { in, out := &in.Projects, &out.Projects *out = make([]Project, len(*in)) @@ -541,10 +563,32 @@ func (in *EnvVar) DeepCopy() *EnvVar { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Events) DeepCopyInto(out *Events) { + *out = *in + in.WorkspaceEvents.DeepCopyInto(&out.WorkspaceEvents) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Events. +func (in *Events) DeepCopy() *Events { + if in == nil { + return nil + } + out := new(Events) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExecCommand) DeepCopyInto(out *ExecCommand) { *out = *in in.LabeledCommand.DeepCopyInto(&out.LabeledCommand) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]EnvVar, len(*in)) + copy(*out, *in) + } return } @@ -613,7 +657,7 @@ func (in *GithubProjectSource) DeepCopy() *GithubProjectSource { func (in *K8sLikeComponent) DeepCopyInto(out *K8sLikeComponent) { *out = *in out.BaseComponent = in.BaseComponent - out.Location = in.Location + out.K8sLikeComponentLocation = in.K8sLikeComponentLocation return } @@ -820,6 +864,11 @@ func (in *PolymorphicComponent) DeepCopyInto(out *PolymorphicComponent) { *out = new(ContainerComponent) (*in).DeepCopyInto(*out) } + if in.Volume != nil { + in, out := &in.Volume, &out.Volume + *out = new(VolumeComponent) + **out = **in + } if in.CheEditor != nil { in, out := &in.CheEditor, &out.CheEditor *out = new(CheEditorComponent) @@ -959,6 +1008,40 @@ func (in *Volume) DeepCopy() *Volume { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeComponent) DeepCopyInto(out *VolumeComponent) { + *out = *in + out.BaseComponent = in.BaseComponent + out.Volume = in.Volume + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeComponent. +func (in *VolumeComponent) DeepCopy() *VolumeComponent { + if in == nil { + return nil + } + out := new(VolumeComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeMount) DeepCopyInto(out *VolumeMount) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeMount. +func (in *VolumeMount) DeepCopy() *VolumeMount { + if in == nil { + return nil + } + out := new(VolumeMount) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VscodeConfigurationCommand) DeepCopyInto(out *VscodeConfigurationCommand) { *out = *in @@ -993,6 +1076,42 @@ func (in *VscodeConfigurationCommandLocation) DeepCopy() *VscodeConfigurationCom return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkspaceEvents) DeepCopyInto(out *WorkspaceEvents) { + *out = *in + if in.PreStart != nil { + in, out := &in.PreStart, &out.PreStart + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostStart != nil { + in, out := &in.PostStart, &out.PostStart + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreStop != nil { + in, out := &in.PreStop, &out.PreStop + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostStop != nil { + in, out := &in.PostStop, &out.PostStop + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceEvents. +func (in *WorkspaceEvents) DeepCopy() *WorkspaceEvents { + if in == nil { + return nil + } + out := new(WorkspaceEvents) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkspacePodContributions) DeepCopyInto(out *WorkspacePodContributions) { *out = *in diff --git a/pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go b/pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go index ed7b64090..d1d1b0ea4 100644 --- a/pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go +++ b/pkg/apis/workspaces/v1alpha1/zz_generated.openapi.go @@ -258,6 +258,12 @@ func schema_pkg_apis_workspaces_v1alpha1_DevWorkspaceTemplateSpec(ref common.Ref }, }, }, + "events": { + SchemaProps: spec.SchemaProps{ + Description: "Bindings of commands to events. Each command is referred-to by its name.", + Ref: ref("github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Events"), + }, + }, "projects": { SchemaProps: spec.SchemaProps{ Description: "Projects worked on in the workspace, containing names and sources locations", @@ -288,7 +294,7 @@ func schema_pkg_apis_workspaces_v1alpha1_DevWorkspaceTemplateSpec(ref common.Ref }, }, Dependencies: []string{ - "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Command", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Component", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Parent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Project"}, + "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Command", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Component", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Events", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Parent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.Project"}, } } @@ -479,6 +485,12 @@ func schema_pkg_apis_workspaces_v1alpha1_PolymorphicComponent(ref common.Referen Ref: ref("github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent"), }, }, + "volume": { + SchemaProps: spec.SchemaProps{ + Description: "Volume component", + Ref: ref("github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.VolumeComponent"), + }, + }, "cheEditor": { SchemaProps: spec.SchemaProps{ Description: "CheEditor component", @@ -523,6 +535,7 @@ func schema_pkg_apis_workspaces_v1alpha1_PolymorphicComponent(ref common.Referen "custom": "Custom", "kubernetes": "Kubernetes", "openshift": "Openshift", + "volume": "Volume", }, }, }, @@ -530,7 +543,7 @@ func schema_pkg_apis_workspaces_v1alpha1_PolymorphicComponent(ref common.Referen }, }, Dependencies: []string{ - "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CheEditorComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ChePluginComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CustomComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.KubernetesComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.OpenshiftComponent"}, + "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CheEditorComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ChePluginComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.ContainerComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.CustomComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.KubernetesComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.OpenshiftComponent", "github.com/che-incubator/devworkspace-api/pkg/apis/workspaces/v1alpha1.VolumeComponent"}, } } diff --git a/samples/example.devworkspace.yaml b/samples/example.devworkspace.yaml index 88ee8f8f3..eb0890068 100644 --- a/samples/example.devworkspace.yaml +++ b/samples/example.devworkspace.yaml @@ -42,4 +42,5 @@ spec: field1: "" field2: "" - kubernetes: + name: "production" url: "https://somewhere/production-environment.yaml" diff --git a/samples/nodejs.devworkspacetemplate.yaml b/samples/nodejs.devworkspacetemplate.yaml index a55cd5666..3cd325c1e 100644 --- a/samples/nodejs.devworkspacetemplate.yaml +++ b/samples/nodejs.devworkspacetemplate.yaml @@ -33,29 +33,29 @@ spec: 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 - 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 - 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 - 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", diff --git a/samples/with-nodejs-parent-devfile.devworkspace.yaml b/samples/with-nodejs-parent-devfile.devworkspace.yaml index 36c6bf2fc..d09a9e348 100644 --- a/samples/with-nodejs-parent-devfile.devworkspace.yaml +++ b/samples/with-nodejs-parent-devfile.devworkspace.yaml @@ -9,6 +9,7 @@ spec: 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 diff --git a/samples/with-nodejs-parent-template.devworkspace.yaml b/samples/with-nodejs-parent-template.devworkspace.yaml index 969a4a631..1a29e3741 100644 --- a/samples/with-nodejs-parent-template.devworkspace.yaml +++ b/samples/with-nodejs-parent-template.devworkspace.yaml @@ -10,6 +10,7 @@ spec: name: nodejs-stack commands: - exec: + id: sayHello label: Say Hello commandLine: echo "hello" component: nodejs diff --git a/schemas/devfile.json b/schemas/devfile.json index 816d384a7..0050b1817 100644 --- a/schemas/devfile.json +++ b/schemas/devfile.json @@ -8,13 +8,11 @@ "composite": { "description": "Composite command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commands": { @@ -24,25 +22,54 @@ }, "type": "array" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, "parallel": { "type": "boolean" } }, + "required": [ + "id" + ], "type": "object" }, "custom": { "description": "Custom command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandClass": { @@ -51,26 +78,53 @@ "embeddedResource": { "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" } }, "required": [ "commandClass", - "embeddedResource" + "embeddedResource", + "id" ], "type": "object" }, "exec": { "description": "Exec command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandLine": { @@ -81,16 +135,64 @@ "description": "Describes component to which given action relates", "type": "string" }, + "env": { + "description": "Optional list of environment variables that have to be set before running the command", + "items": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "type": "array" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, - "workdir": { + "workingDir": { "description": "Working directory where the command should be executed", "type": "string" } }, "required": [ - "commandLine" + "commandLine", + "id" ], "type": "object" }, @@ -107,15 +209,40 @@ "vscodeLaunch": { "description": "VscodeLaunch command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -129,20 +256,48 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" }, "vscodeTask": { "description": "VscodeTask command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -156,6 +311,9 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" } }, @@ -170,9 +328,6 @@ "cheEditor": { "description": "CheEditor component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -184,6 +339,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -209,9 +368,6 @@ "chePlugin": { "description": "ChePlugin component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -223,6 +379,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -248,9 +408,6 @@ "container": { "description": "Container component", "properties": { - "alias": { - "type": "string" - }, "endpoints": { "items": { "properties": { @@ -313,6 +470,7 @@ "type": "array" }, "env": { + "description": "Environment variables used in this container", "items": { "properties": { "name": { @@ -342,21 +500,27 @@ "name": { "type": "string" }, - "volumes": { + "sourceMapping": { + "description": "Optional specification of the path in the container where project sources should be transferred/mounted when `mountSources` is `true`. When omitted, the value of the `PROJECTS_ROOT` environment variable is used.", + "type": "string" + }, + "volumeMounts": { + "description": "List of volumes mounts that should be mounted is this container.", "items": { "description": "Volume that should be mounted to a component container", "properties": { - "mountPath": { + "name": { + "description": "The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files.", "type": "string" }, - "name": { - "description": "The volume name. If several components mount the same volume then they will reuse the volume and will be able to access to the same files", + "path": { + "description": "The path in the component container where the volume should be mounted", "type": "string" } }, "required": [ - "mountPath", - "name" + "name", + "path" ], "type": "object" }, @@ -392,9 +556,6 @@ "kubernetes": { "description": "Kubernetes component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -403,19 +564,23 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "openshift": { "description": "Openshift component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -424,11 +589,18 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "type": { @@ -438,16 +610,68 @@ "Kubernetes", "Openshift", "CheEditor", + "Volume", "ChePlugin", "Custom" ], "type": "string" + }, + "volume": { + "description": "Volume component", + "properties": { + "name": { + "description": "Mandatory name that allows referencing the Volume component in Container volume mounts or inside a parent", + "type": "string" + }, + "size": { + "description": "Size of the volume", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" } }, "type": "object" }, "type": "array" }, + "events": { + "description": "Bindings of commands to events. Each command is referred-to by its name.", + "properties": { + "postStart": { + "description": "Names of commands that should be executed after the workspace is completely started. In the case of Che-Theia, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE in his browser.", + "items": { + "type": "string" + }, + "type": "array" + }, + "postStop": { + "description": "Names of commands that should be executed after stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStart": { + "description": "Names of commands that should be executed before the workspace start. Kubernetes-wise, these commands would typically be executed in init containers of the workspace POD.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStop": { + "description": "Names of commands that should be executed before stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "parent": { "description": "Parent workspace template", "properties": { @@ -610,9 +834,20 @@ }, "type": "array" }, - "name": { - "type": "string", - "description": "devfile name" + "metadata": { + "type": "object", + "description": "Optional metadata", + "properties": { + "version": { + "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-]+)*)?$" + }, + "name": { + "type": "string", + "description": "Optional devfile name" + } + } }, "schemaVersion": { "type": "string", @@ -622,7 +857,6 @@ }, "type": "object", "required": [ - "name", "schemaVersion" ] } diff --git a/schemas/devworkspace-template-spec.json b/schemas/devworkspace-template-spec.json index 3985de72c..8fbd5ee18 100644 --- a/schemas/devworkspace-template-spec.json +++ b/schemas/devworkspace-template-spec.json @@ -8,13 +8,11 @@ "composite": { "description": "Composite command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commands": { @@ -24,25 +22,54 @@ }, "type": "array" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, "parallel": { "type": "boolean" } }, + "required": [ + "id" + ], "type": "object" }, "custom": { "description": "Custom command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandClass": { @@ -51,26 +78,53 @@ "embeddedResource": { "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" } }, "required": [ "commandClass", - "embeddedResource" + "embeddedResource", + "id" ], "type": "object" }, "exec": { "description": "Exec command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandLine": { @@ -81,16 +135,64 @@ "description": "Describes component to which given action relates", "type": "string" }, + "env": { + "description": "Optional list of environment variables that have to be set before running the command", + "items": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "type": "array" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, - "workdir": { + "workingDir": { "description": "Working directory where the command should be executed", "type": "string" } }, "required": [ - "commandLine" + "commandLine", + "id" ], "type": "object" }, @@ -107,15 +209,40 @@ "vscodeLaunch": { "description": "VscodeLaunch command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -129,20 +256,48 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" }, "vscodeTask": { "description": "VscodeTask command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", + "type": "object" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], "type": "object" }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -156,6 +311,9 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" } }, @@ -170,9 +328,6 @@ "cheEditor": { "description": "CheEditor component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -184,6 +339,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -209,9 +368,6 @@ "chePlugin": { "description": "ChePlugin component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -223,6 +379,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -248,9 +408,6 @@ "container": { "description": "Container component", "properties": { - "alias": { - "type": "string" - }, "endpoints": { "items": { "properties": { @@ -272,7 +429,7 @@ "type": "string" }, "protocol": { - "description": "The is the transport-layer protocol of traffic coming through this endpoint. Default value is \"tcp\"", + "description": "The is the low-level protocol of traffic coming through this endpoint. Default value is \"tcp\"", "type": "string" }, "public": { @@ -313,6 +470,7 @@ "type": "array" }, "env": { + "description": "Environment variables used in this container", "items": { "properties": { "name": { @@ -342,21 +500,27 @@ "name": { "type": "string" }, - "volumes": { + "sourceMapping": { + "description": "Optional specification of the path in the container where project sources should be transferred/mounted when `mountSources` is `true`. When omitted, the value of the `PROJECTS_ROOT` environment variable is used.", + "type": "string" + }, + "volumeMounts": { + "description": "List of volumes mounts that should be mounted is this container.", "items": { "description": "Volume that should be mounted to a component container", "properties": { - "mountPath": { + "name": { + "description": "The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files.", "type": "string" }, - "name": { - "description": "The volume name. If several components mount the same volume then they will reuse the volume and will be able to access to the same files", + "path": { + "description": "The path in the component container where the volume should be mounted", "type": "string" } }, "required": [ - "mountPath", - "name" + "name", + "path" ], "type": "object" }, @@ -392,9 +556,6 @@ "kubernetes": { "description": "Kubernetes component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -403,19 +564,23 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "openshift": { "description": "Openshift component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -424,11 +589,18 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "type": { @@ -438,16 +610,68 @@ "Kubernetes", "Openshift", "CheEditor", + "Volume", "ChePlugin", "Custom" ], "type": "string" + }, + "volume": { + "description": "Volume component", + "properties": { + "name": { + "description": "Mandatory name that allows referencing the Volume component in Container volume mounts or inside a parent", + "type": "string" + }, + "size": { + "description": "Size of the volume", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" } }, "type": "object" }, "type": "array" }, + "events": { + "description": "Bindings of commands to events. Each command is referred-to by its name.", + "properties": { + "postStart": { + "description": "Names of commands that should be executed after the workspace is completely started. In the case of Che-Theia, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE in his browser.", + "items": { + "type": "string" + }, + "type": "array" + }, + "postStop": { + "description": "Names of commands that should be executed after stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStart": { + "description": "Names of commands that should be executed before the workspace start. Kubernetes-wise, these commands would typically be executed in init containers of the workspace POD.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStop": { + "description": "Names of commands that should be executed before stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "parent": { "description": "Parent workspace template", "properties": { diff --git a/schemas/devworkspace-template.json b/schemas/devworkspace-template.json index c4ba7a758..5c8c5df4b 100644 --- a/schemas/devworkspace-template.json +++ b/schemas/devworkspace-template.json @@ -22,13 +22,11 @@ "composite": { "description": "Composite command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commands": { @@ -38,25 +36,54 @@ }, "type": "array" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, "parallel": { "type": "boolean" } }, + "required": [ + "id" + ], "type": "object" }, "custom": { "description": "Custom command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandClass": { @@ -65,26 +92,53 @@ "embeddedResource": { "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" } }, "required": [ "commandClass", - "embeddedResource" + "embeddedResource", + "id" ], "type": "object" }, "exec": { "description": "Exec command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandLine": { @@ -95,16 +149,64 @@ "description": "Describes component to which given action relates", "type": "string" }, + "env": { + "description": "Optional list of environment variables that have to be set before running the command", + "items": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "type": "array" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, - "workdir": { + "workingDir": { "description": "Working directory where the command should be executed", "type": "string" } }, "required": [ - "commandLine" + "commandLine", + "id" ], "type": "object" }, @@ -121,15 +223,40 @@ "vscodeLaunch": { "description": "VscodeLaunch command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -143,20 +270,48 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" }, "vscodeTask": { "description": "VscodeTask command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", + "type": "object" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], "type": "object" }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -170,6 +325,9 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" } }, @@ -184,9 +342,6 @@ "cheEditor": { "description": "CheEditor component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -198,6 +353,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -223,9 +382,6 @@ "chePlugin": { "description": "ChePlugin component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -237,6 +393,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -262,9 +422,6 @@ "container": { "description": "Container component", "properties": { - "alias": { - "type": "string" - }, "endpoints": { "items": { "properties": { @@ -327,6 +484,7 @@ "type": "array" }, "env": { + "description": "Environment variables used in this container", "items": { "properties": { "name": { @@ -356,21 +514,27 @@ "name": { "type": "string" }, - "volumes": { + "sourceMapping": { + "description": "Optional specification of the path in the container where project sources should be transferred/mounted when `mountSources` is `true`. When omitted, the value of the `PROJECTS_ROOT` environment variable is used.", + "type": "string" + }, + "volumeMounts": { + "description": "List of volumes mounts that should be mounted is this container.", "items": { "description": "Volume that should be mounted to a component container", "properties": { - "mountPath": { + "name": { + "description": "The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files.", "type": "string" }, - "name": { - "description": "The volume name. If several components mount the same volume then they will reuse the volume and will be able to access to the same files", + "path": { + "description": "The path in the component container where the volume should be mounted", "type": "string" } }, "required": [ - "mountPath", - "name" + "name", + "path" ], "type": "object" }, @@ -406,9 +570,6 @@ "kubernetes": { "description": "Kubernetes component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -417,19 +578,23 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "openshift": { "description": "Openshift component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -438,11 +603,18 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "type": { @@ -452,16 +624,68 @@ "Kubernetes", "Openshift", "CheEditor", + "Volume", "ChePlugin", "Custom" ], "type": "string" + }, + "volume": { + "description": "Volume component", + "properties": { + "name": { + "description": "Mandatory name that allows referencing the Volume component in Container volume mounts or inside a parent", + "type": "string" + }, + "size": { + "description": "Size of the volume", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" } }, "type": "object" }, "type": "array" }, + "events": { + "description": "Bindings of commands to events. Each command is referred-to by its name.", + "properties": { + "postStart": { + "description": "Names of commands that should be executed after the workspace is completely started. In the case of Che-Theia, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE in his browser.", + "items": { + "type": "string" + }, + "type": "array" + }, + "postStop": { + "description": "Names of commands that should be executed after stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStart": { + "description": "Names of commands that should be executed before the workspace start. Kubernetes-wise, these commands would typically be executed in init containers of the workspace POD.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStop": { + "description": "Names of commands that should be executed before stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "parent": { "description": "Parent workspace template", "properties": { diff --git a/schemas/devworkspace.json b/schemas/devworkspace.json index d3027cc76..7bdf3ca19 100644 --- a/schemas/devworkspace.json +++ b/schemas/devworkspace.json @@ -31,13 +31,11 @@ "composite": { "description": "Composite command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commands": { @@ -47,25 +45,54 @@ }, "type": "array" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, "parallel": { "type": "boolean" } }, + "required": [ + "id" + ], "type": "object" }, "custom": { "description": "Custom command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandClass": { @@ -74,26 +101,53 @@ "embeddedResource": { "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" } }, "required": [ "commandClass", - "embeddedResource" + "embeddedResource", + "id" ], "type": "object" }, "exec": { "description": "Exec command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, "commandLine": { @@ -104,16 +158,64 @@ "description": "Describes component to which given action relates", "type": "string" }, + "env": { + "description": "Optional list of environment variables that have to be set before running the command", + "items": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "type": "array" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "label": { + "description": "Optional label that provides a label for this command to be used in Editor UI menus for example", "type": "string" }, - "workdir": { + "workingDir": { "description": "Working directory where the command should be executed", "type": "string" } }, "required": [ - "commandLine" + "commandLine", + "id" ], "type": "object" }, @@ -130,15 +232,40 @@ "vscodeLaunch": { "description": "VscodeLaunch command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", "type": "object" }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], + "type": "object" + }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -152,20 +279,48 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" }, "vscodeTask": { "description": "VscodeTask command", "properties": { - "alias": { - "type": "string" - }, "attributes": { "additionalProperties": { "type": "string" }, + "description": "Optional map of free-form additional command attributes", + "type": "object" + }, + "group": { + "description": "Defines the group this command is part of", + "properties": { + "isDefault": { + "description": "Identifies the default command for a given group kind", + "type": "boolean" + }, + "kind": { + "description": "Kind of group the command is part of", + "enum": [ + "build", + "run", + "test", + "debug" + ], + "type": "string" + } + }, + "required": [ + "kind" + ], "type": "object" }, + "id": { + "description": "Mandatory identifier that allows referencing this command in composite commands, or from a parent, or in events.", + "type": "string" + }, "inlined": { "description": "Embedded content of the vscode configuration file", "type": "string" @@ -179,6 +334,9 @@ "type": "string" } }, + "required": [ + "id" + ], "type": "object" } }, @@ -193,9 +351,6 @@ "cheEditor": { "description": "CheEditor component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -207,6 +362,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -232,9 +391,6 @@ "chePlugin": { "description": "ChePlugin component", "properties": { - "alias": { - "type": "string" - }, "locationType": { "description": "Type of plugin location", "enum": [ @@ -246,6 +402,10 @@ "memoryLimit": { "type": "string" }, + "name": { + "description": "Optional name that allows referencing the component in commands, or inside a parent If omitted it will be infered from the location (uri or registryEntry)", + "type": "string" + }, "registryEntry": { "description": "Location of an entry inside a plugin registry", "properties": { @@ -271,9 +431,6 @@ "container": { "description": "Container component", "properties": { - "alias": { - "type": "string" - }, "endpoints": { "items": { "properties": { @@ -336,6 +493,7 @@ "type": "array" }, "env": { + "description": "Environment variables used in this container", "items": { "properties": { "name": { @@ -365,21 +523,27 @@ "name": { "type": "string" }, - "volumes": { + "sourceMapping": { + "description": "Optional specification of the path in the container where project sources should be transferred/mounted when `mountSources` is `true`. When omitted, the value of the `PROJECTS_ROOT` environment variable is used.", + "type": "string" + }, + "volumeMounts": { + "description": "List of volumes mounts that should be mounted is this container.", "items": { "description": "Volume that should be mounted to a component container", "properties": { - "mountPath": { + "name": { + "description": "The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files.", "type": "string" }, - "name": { - "description": "The volume name. If several components mount the same volume then they will reuse the volume and will be able to access to the same files", + "path": { + "description": "The path in the component container where the volume should be mounted", "type": "string" } }, "required": [ - "mountPath", - "name" + "name", + "path" ], "type": "object" }, @@ -415,9 +579,6 @@ "kubernetes": { "description": "Kubernetes component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -426,19 +587,23 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "openshift": { "description": "Openshift component", "properties": { - "alias": { - "type": "string" - }, "inlined": { "description": "Reference to the plugin definition", "type": "string" @@ -447,11 +612,18 @@ "description": "Type of Kubernetes-like location", "type": "string" }, + "name": { + "description": "Mandatory name that allows referencing the component in commands, or inside a parent", + "type": "string" + }, "url": { "description": "Location in a plugin registry", "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "type": { @@ -461,16 +633,68 @@ "Kubernetes", "Openshift", "CheEditor", + "Volume", "ChePlugin", "Custom" ], "type": "string" + }, + "volume": { + "description": "Volume component", + "properties": { + "name": { + "description": "Mandatory name that allows referencing the Volume component in Container volume mounts or inside a parent", + "type": "string" + }, + "size": { + "description": "Size of the volume", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" } }, "type": "object" }, "type": "array" }, + "events": { + "description": "Bindings of commands to events. Each command is referred-to by its name.", + "properties": { + "postStart": { + "description": "Names of commands that should be executed after the workspace is completely started. In the case of Che-Theia, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE in his browser.", + "items": { + "type": "string" + }, + "type": "array" + }, + "postStop": { + "description": "Names of commands that should be executed after stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStart": { + "description": "Names of commands that should be executed before the workspace start. Kubernetes-wise, these commands would typically be executed in init containers of the workspace POD.", + "items": { + "type": "string" + }, + "type": "array" + }, + "preStop": { + "description": "Names of commands that should be executed before stopping the workspace.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, "parent": { "description": "Parent workspace template", "properties": {