Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement agreed-on devfile 2.0 issues #35

Merged
merged 16 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
amisevsk marked this conversation as resolved.
Show resolved Hide resolved
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