Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Export configurations of Che tasks to config file #355

Merged
merged 2 commits into from
Jul 18, 2019

Conversation

RomanNikitenko
Copy link
Member

@RomanNikitenko RomanNikitenko commented Jul 17, 2019

What does this PR do?

Export configurations of Che tasks to config file
commands section of devfile can contain actions with che commands, for example:

commands:
- name: task-plugin:watch
  actions:
  - type: exec
    component: che-dev
    command: >
              yarn watch
    workdir: /projects/che-theia/plugins/task-plugin

- name: che-theia:build
  actions:
  - type: exec
    component: che-dev
    command: >
              yarn
    workdir: /projects/che-theia

The PR allows to convert them to theia tasks format and copy to config file of current workspace folder. After that they are available for running from UI: Terminal => Run Task menu or using My Workspace panel. So now we consider tasks.json file as one source where user can find all che tasks, edit them or add a new task.

The current implementation allows to merge existed configurations from config file and configs from devfile. So user can add new configurations to config file or edit existed ones - the changes are stored to config file.

How to test

Use the component in your devfile

- 
    alias: theia-editor
    reference: >-
      https://raw.githubusercontent.com/RomanNikitenko/che-plugin-registry/master/v3/plugins/eclipse/che-theia/custom/meta.yaml
    type: cheEditor

The image contains:

You can use commands section above as example to provide some tasks in your config file.
Please, try to run che commands using Terminal => Run Task menu and My Workspace panel as well

What issues does this PR fix or reference?

eclipse-che/che#13392
https://github.com/eclipse/che-theia/issues/248

  • fixes for Che commands the issue: Can not run Configured task eclipse-theia/theia#5064
    We provided che commands as detected theia tasks. The issue was caused by changes in theia project (the description contains reference to the code) and was reproduced at moving a task from detected to configured section. The issue is not relevant as now che tasks are citizens of tasks.json file and available for editing without moving from detected to configured section.

  • fixes for Che commands the issue: Recently used tasks section should respect configured tasks eclipse-theia/theia#5067
    The issue was manifested when user run a task after configuring from recently used section. The original configuration was run, not overrided. It’s not relevant anymore - che tasks have only one source now - tasks.json file.

  • fixes for Che commands the issue: Contributed Task Configuration question eclipse-theia/theia#4928
    The issue was relevant for detected tasks, according to the changes of this PR we consider che commands as configured theia tasks, so it’s not relevant for che commands anymore.

Signed-off-by: Roman Nikitenko rnikiten@redhat.com

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
private getRootPath(): string {
const workspaceFolders = theia.workspace.workspaceFolders;
if (!workspaceFolders || workspaceFolders.length < 1) {
return '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we need to return /projects

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense, thank you!
Done!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really confusable for me that we have a case when there is no opened workspace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to stop command execution in that case at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry - you wrote the comment in 4 minutes after the PR merging.
We can consider your issue eclipse-che/che#13909 or improve the current behaviour in this place in another PR.
WDYT?

@tolusha
Copy link
Contributor

tolusha commented Jul 18, 2019

I've checked the provided image and can't reproduce the issue eclipse-che/che#13799

@benoitf
Copy link
Contributor

benoitf commented Jul 18, 2019

FYI build is failing

Copy link
Contributor

@akurinnoy akurinnoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine!

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
@RomanNikitenko
Copy link
Member Author

RomanNikitenko commented Jul 18, 2019

FYI build is failing

@benoitf
thank you! now it's success, so I'm going to merge the PR.

thank you all for testing and review!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants