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

Fix resolving of variables for che commands #373

Merged
merged 2 commits into from
Aug 2, 2019
Merged

Conversation

RomanNikitenko
Copy link
Member

What does this PR do?

Allows to resolve variables for che commands before execution.
For example you can define command in your devfile:

- name: copy content
  actions:
  - type: exec
    component: che-dev
    command: >
              cp ${workspaceFolder}/.theia/tasks.json ${workspaceFolder}/cheCommands.json
    workdir: /projects

and ${workspaceFolder} will be replaced by /projects for example, or use ${file} to get path to
the file opened in the current editor

What issues does this PR fix or reference?

eclipse-che/che#14031

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:

  • che-7.0.0 theia branch
  • current 7.0.0 branch of che-theia + changes from the PR

Use a command with variables in your devfile, the simple example you can see above.

Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
@AndrienkoAleksandr
Copy link
Contributor

I want to test this branch.

@RomanNikitenko
Copy link
Member Author

RomanNikitenko commented Jul 26, 2019

I want to test this branch.

@AndrienkoAleksandr
I'd appreciate it!
Do you need any help from my side for it?

@azatsarynnyy
Copy link
Member

It would be nice to add resolving the variables in target.workingDir property as well. It's very helpful.

@RomanNikitenko
Copy link
Member Author

It would be nice to add resolving the variables in target.workingDir property as well. It's very helpful.

maybe it's implemented on machine-exec level, because I see that variables are used for workingDir in devfiles for samples.

@AndrienkoAleksandr
Copy link
Contributor

maybe it's implemented on machine-exec level, because I see that variables are used for workingDir in devfiles for samples.

che-machine-exec doesn't do such things.

@azatsarynnyy
Copy link
Member

${CHE_PROJECTS_ROOT} it's not Theia's substitution variable but the environment variable

@RomanNikitenko
Copy link
Member Author

@AndrienkoAleksandr @azatsarynnyy
thank you for clarification!

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

@AndrienkoAleksandr @azatsarynnyy @olexii4
I added resolving of the variables for workingDir property after your review.

btw: I updated the images for testing (No pressure, just info for case if somebody wants to try it).

@AndrienkoAleksandr
Copy link
Contributor

Tested, works fine.

@RomanNikitenko
Copy link
Member Author

@slemeur
Can I merge the PR into 7.0.0 branch?
thank you!

@slemeur
Copy link

slemeur commented Aug 1, 2019

I'm +1 for it.
@l0rd

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.

6 participants