Skip to content

Commit

Permalink
Implement agreement on issue #18
Browse files Browse the repository at this point in the history
Signed-off-by: David Festal <dfestal@redhat.com>
  • Loading branch information
davidfestal committed Apr 3, 2020
1 parent e023a38 commit 2a3a2c5
Show file tree
Hide file tree
Showing 13 changed files with 250 additions and 103 deletions.
49 changes: 39 additions & 10 deletions deploy/crds/workspaces.ecd.eclipse.org_devworkspaces_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ spec:
composite:
description: Composite command
properties:
alias:
type: string
attributes:
additionalProperties:
type: string
Expand All @@ -58,16 +56,23 @@ spec:
items:
type: string
type: array
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
Expand All @@ -76,17 +81,23 @@ spec:
type: string
embeddedResource:
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
Expand All @@ -98,14 +109,22 @@ spec:
description: Describes component to which given action
relates
type: string
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:
description: Working directory where the command should
be executed
type: string
required:
- commandLine
- id
type: object
type:
description: Type of workspace command
Expand All @@ -118,12 +137,15 @@ spec:
vscodeLaunch:
description: VscodeLaunch command
properties:
alias:
type: string
attributes:
additionalProperties:
type: string
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
Expand All @@ -134,16 +156,21 @@ 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
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
Expand All @@ -154,6 +181,8 @@ spec:
url:
description: Location as an absolute of relative URL
type: string
required:
- id
type: object
type: object
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ spec:
composite:
description: Composite command
properties:
alias:
type: string
attributes:
additionalProperties:
type: string
Expand All @@ -49,16 +47,23 @@ spec:
items:
type: string
type: array
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
Expand All @@ -67,17 +72,23 @@ spec:
type: string
embeddedResource:
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
Expand All @@ -88,14 +99,22 @@ spec:
component:
description: Describes component to which given action relates
type: string
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:
description: Working directory where the command should be
executed
type: string
required:
- commandLine
- id
type: object
type:
description: Type of workspace command
Expand All @@ -108,12 +127,15 @@ spec:
vscodeLaunch:
description: VscodeLaunch command
properties:
alias:
type: string
attributes:
additionalProperties:
type: string
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
Expand All @@ -124,16 +146,21 @@ 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
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
Expand All @@ -144,6 +171,8 @@ spec:
url:
description: Location as an absolute of relative URL
type: string
required:
- id
type: object
type: object
type: array
Expand Down
10 changes: 5 additions & 5 deletions devfile-support/samples/nodejs-stack.devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ components:
mountSources: true
commands:
- exec:
alias: download dependencies
id: download dependencies
component: nodejs
commandLine: npm install
workdir: ${CHE_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
- 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
- exec:
alias: stop the app
id: stop the app
component: nodejs
commandLine: >-
node_server_pids=$(pgrep -fx '.*nodemon (--inspect )?app.js' | tr "\\n" " ") &&
echo "Stopping node server with PIDs: ${node_server_pids}" &&
kill -15 ${node_server_pids} &>/dev/null && echo 'Done.'
- vscodeLaunch:
alias: Attach remote debugger
id: Attach remote debugger
inlined: |
{
"version": "0.2.0",
Expand Down
7 changes: 5 additions & 2 deletions devfile-support/samples/simple-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ projects:
branch: "master"
commands:
- exec:
id: buildSchema
label: Build the schema
commandLine: "./buildSchema.sh"
component: build-tools
alias: buildSchema
- vscodeTask:
alias: openDevfile
id: openDevfile
inlined:
json
- composite:
id: buildSchemaAndOpenDevfile
Label: Build schema and open devfile
commands:
- buildSchema
- openDevfile
parallel: false
- custom:
id: myCustomCommand
commandClass: myCommandType
embeddedResource:
myEmbeddedObject:
Expand Down
1 change: 1 addition & 0 deletions devfile-support/samples/with-nodejs-parent.devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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
11 changes: 9 additions & 2 deletions pkg/apis/workspaces/v1alpha1/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ const (
)

type BaseCommand struct {
Alias string `json:"alias,omitempty"`
// Mandatory identifier that allows referencing
// this command in composite commands, or from
// a parent, or in events.
Id string `json:"id"`
Attributes map[string]string `json:"attributes,omitempty"` // Additional command attributes
}

type LabeledCommand struct {
BaseCommand `json:",inline"`

// +optional
// Optional label that provides a label for this command
// to be used in Editor UI menus for example
Label string `json:"label,omitempty"`
}

Expand Down Expand Up @@ -100,7 +107,7 @@ type VscodeConfigurationCommandLocation struct {
}

type VscodeConfigurationCommand struct {
BaseCommand `json:",inline"`
BaseCommand `json:",inline"`
VscodeConfigurationCommandLocation `json:",inline"`
}

Expand Down
Loading

0 comments on commit 2a3a2c5

Please sign in to comment.