-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[POC] tasks and launch configuration as part of Devfile #13057
Comments
VSCode has these abilities in tasks
VSCode options for launch.json Different types of run/debug servers support different sets of options
Commonly supported options are:
|
Given the summary above, as a first draft, I propose the following changes.
commands:
- name: build
component: component
build:
cwd: sadf
command: asdf
args: [ ... ]
env:
key: value
shell: asdf
default: bool
test:
... the same props as build ...
launch:
type: debugger to use
attributes:
key: value
key:
complex: value
... this is a free-form map-of-any to support the per-debugger type attributes.
attach:
... same props as launch ... Of course, the above just lists all the possible command types. A concrete command definition would look more like: commands:
- name: che-theia ... build
build:
cwd: ${workspaceDir}/che-theia
command: yarn
default: true Compared to VS code the above DOESN'T support:
|
@l0rd @slemeur We have two conceptual issues in the horizont. Basically, we can try to put such structures as task.json or laounch.json in yaml as a string. Something like commands:
- name: vscode
actions:
- type: vscode-launch.json
component: jdt.ls
configurations: |
- type: node
request: launch
name: Gulp Build
program: "${workspaceFolder}/node_modules/gulp/bin/gulp.js"
stopOnEntry: true
args:
- hygiene
- type: node
request: attach
name: Attach to Extension Host
port: 5870
restart: true
outFiles:
- "${workspaceFolder}/out/**/*.js"
- type: node
request: launch
name: Launch Smoke Test
program: "${workspaceFolder}/test/smoke/out/main.js"
cwd: "${workspaceFolder}/test/smoke"
timeout: 240000
port: 9999
args:
- "-l"
- "${workspaceFolder}/.build/electron/Code - OSS.app/Contents/MacOS/Electron"
outFiles:
- "${cwd}/out/**/*.js"
env:
NODE_ENV: development
VSCODE_DEV: '1'
VSCODE_CLI: '1'
- type: vscode-task.json
component: theia
tasks: |
- type: npm
script: watch
label: Build VS Code
group: build
isBackground: true
presentation:
reveal: never
problemMatcher:
owner: typescript
applyTo: closedDocuments
fileLocation:
- absolute
pattern:
regexp: 'Error: ([^(]+)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\): (.*)$'
file: 1
location: 2
message: 3
background:
beginsPattern: Starting compilation
endsPattern: Finished compilation
- type: npm
script: strict-initialization-watch
label: TS - Strict Initialization
isBackground: true
presentation:
reveal: never
problemMatcher:
base: "$tsc-watch"
owner: typescript-strict-initialization
applyTo: allDocuments or something like @metlos proposed #13057 (comment). Another approach is to get a subset of task.json or laounch.json and try to make them somehow K8s-compliant, as a base we can take |
@skabashnyuk @metlos as discussed during today call I would like to avoid to embed the One proposal is to define a Another alternative would be to support a limited |
I agree with @l0rd that embedding the JSON in the devfile YAML is ugly and we should avoid it. For the problem of actions - I am not sure VS code/Theia natively support tasks consisting of several steps, so this would have to be handled at the I like the idea of Therefore I propose this: # leave commands mostly as is
commands:
- name: test and manual test
attributes:
group: test
actions:
- type: exec # I frankly still don't understand what we need this for
component: mvn-stack
command: mvn clean package
- component: runtime
command: java -jar service.jar
workdir: $CHE_PROJECTS_ROOT/service/target
# This is new stuff to support editor-specific configuration
editorConfiguration:
- editor: org.eclipse.che.editor.theia:1.0.0
- type: tasks
reference: ../ide-config/vs-code/tasks.json
- type: launch
reference: ../ide-config/vs-code/launch.json
- type: formatting
reference: https://acme.com/developer/vs-code-java-formatting.xml In the above, the only thing that the devfile author needs to understand is that the commands end up being tasks in Theia. This behavior is actually editor-specific (because I assume each editor is going to "materialize" the commands differently) and so this information can only be documented, not codified in the format IMHO. I'm not happy with the The |
@metlos a few comments
This means that we are going to execute the command in a container (i.e.
I don't understand your concern and the need for
Yes that's why I would rather use types |
👍 thanks for the explanation
Where would you place the references to launch/tasks?
Well, the default editor and plugins are configurable, so the admin can actually change that to something else than Theia.
👍 for prefixing the type names.
How do you mean that?
If we assume that the devfile is going to be used by other development tools besides Che, can we still assume that the default editor is always going to be Theia? |
I think that has been an error. I mean we have made our life more difficult for something that doesn't come from a real user feedback and that doesn't really make sense currently (che-theia is the only real editor atm). That's what I call goldplating and I am probably the one to blame for that. To solve that let's assume that the default editor is always che-theia. The day there will be a real alternative we will discuss this but for now let's forget about it.
Something like # leave commands mostly as is
commands:
- name: test and manual test
attributes:
group: test
actions:
- type: exec # I frankly still don't understand what we need this for
component: mvn-stack
command: mvn clean package
- component: runtime
command: java -jar service.jar
workdir: $CHE_PROJECTS_ROOT/service/target
- name: run
actions:
- type: vscode-task
component: mvn-stack
reference: ../ide-config/vs-code/tasks.json
- name: debug
actions:
- type: vscode-launch
component: mvn-stack
reference: ../ide-config/vs-code/launch.json
- name: format
actions:
- type: vscode-formatting
reference: https://acme.com/developer/vs-code-java-formatting.xml
This is a |
Today after the discussion with @vparfonov @l0rd @metlos @RomanNikitenko @tolusha we had such variants: Command oriented commands:
- name: test and manual test
attributes:
group: test
actions:
- type: exec # I frankly still don't understand what we need this for
component: mvn-stack
command: mvn clean package
- component: runtime
command: java -jar service.jar
workdir: $CHE_PROJECTS_ROOT/service/target
- name: run
actions:
- type: vscode-task
reference: ../ide-config/vs-code/tasks.json
- name: debug
actions:
- type: vscode-launch
reference: ../ide-config/vs-code/launch.json File oriented components:
- alias: mvn-stack
type: chePlugin
id: org.eclipse.chemaven-jdk8:1.0.0
- type: cheEditor
id: org.eclipse.chetheia:0.0.3
files:
- name: ${PROJECT_ROOT}/task.json
reference: ../ide-config/vs-code/tasks.json
- name: launch.json
reference: ../ide-config/vs-code/launch.json |
Since I wasn't able to stay until the end of the meeting, here are my 2c on the new proposals: commands:
- name: test and manual test
attributes:
group: test
actions:
- type: exec
component: mvn-stack
command: mvn clean package
- component: runtime
command: java -jar service.jar
workdir: $CHE_PROJECTS_ROOT/service/target
- name: run
actions:
- type: vscode-task
reference: ../ide-config/vs-code/tasks.json I understand the lack of the - name: debug
actions:
- type: vscode-launch
reference: ../ide-config/vs-code/launch.json as a general remark, I don't particularly like the fact that the reference to a "command file" is embedded in what about: commands:
list:
- name: test and manual test
attributes:
group: test
actions:
- type: exec # I frankly still don't understand what we need this for
component: mvn-stack
command: mvn clean package
- component: runtime
command: java -jar service.jar
workdir: $CHE_PROJECTS_ROOT/service/target
external:
- name: run
type: vscode-task
reference: ../ide-config/vs-code/tasks.json I'm not sure the file-oriented approach would not limit us in the future because it makes it hard to define tasks that would span several components if I understand it correctly. |
At the moment for Che tasks we register own runner and specify 'che' type for our tasks. So when theia tries to run Che task it finds runner by type and redirects running of a task to our runner. |
I decided not to pursue the file-based approach, i.e. to reference the files directly with the components.
For the above reasons I think the file-based approach is too broad for the feature that we're trying to implement here. We might find it useful in the future but it should be specifically for the purpose of the runtime image modification - and that will require more thought about what should and should not be allowed. |
So, commands section will look like:
We will use |
About running tasks in a specific container. update: |
I've added a couple of tests and made the PR #13273 ready for review. |
The server-side status is: #13273 is ready, but we need approval on the final format of the devfile before proceeding. |
The tasks have a type that governs how they are run. I guess it is reasonable to state that the |
I tested only tasks for typescript remote plugin, but I guess the behavior is the same for all remote plugins. Maybe somebody who worked on remote plugins can provide more info about this case |
@metlos @skabashnyuk can we close this issue? Have we added some examples of |
There is still https://github.com/eclipse/che-theia/issues/217 but that needs to be figured out on the UI side first. We may need to revisit the approach implemented here but that can be done in a different issue. Closing this since the functionality is in che master. |
Description
[POC] tasks and launch configuration as part of devfile
As a part of the solution of these issues
we can think about extending Devfile with tasks and launch configurations.
For example like this
The goal of this task would be a study of:
and propose some variants
The text was updated successfully, but these errors were encountered: