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

Add Devfile plugin for provision Run Configurations #78

Merged
merged 1 commit into from
Feb 3, 2022
Merged

Conversation

vzhukovs
Copy link
Collaborator

@vzhukovs vzhukovs commented Jan 29, 2022

Current changes proposal provides plugin for Devfile support. Especially for provision commands from Devfile as Run Configuration in IntelliJ-based IDEs.

Снимок экрана 2022-01-28 в 11 53 15

Plugin listens to Project open event and look for environment variable DEVWORKSPACE_FLATTENED_DEVFILE. Then, when Project is opened it takes content by DEVWORKSPACE_FLATTENED_DEVFILE and parses exec commands:
Снимок экрана 2022-01-28 в 11 53 53

Then user is able to run command provided by Devfile from the IDE UI:
Снимок экрана 2022-01-28 в 11 54 09

To check how it works with already created Devfiles it is enough to create the workspace from the following factory link:

https://<your-che-host>/dashboard/#https://github.com/che-samples/bash/tree/devfilev2?che-editor=https://gist.githubusercontent.com/vzhukovs/2bf66c67025c7c1167c3e926bb23646b/raw/7371235eb471269ec1308e02b05bc88298af49e0/devfile.yaml

or create the workspace from the following repository: https://github.com/vzhukovs/che-21029

Снимок экрана 2022-01-29 в 02 06 05

fixes eclipse-che/che#21029

Signed-off-by: Vladyslav Zhukovskyi vzhukovs@redhat.com

@benoitf
Copy link
Contributor

benoitf commented Jan 29, 2022

Hello, could you make sure that omitting working directory will use PROJECT_SOURCE folder
A little bit of context:
eclipse-che/che#21079

( And of course it could be a following PR)

@vzhukovs
Copy link
Collaborator Author

Hello, could you make sure that omitting working directory will use PROJECT_SOURCE folder A little bit of context: eclipse/che#21079

( And of course it could be a following PR)

Hi! If property workingDir is missed in the Devfile command, then it won't be provided to Run Configuration: https://github.com/che-incubator/jetbrains-editor-images/pull/78/files#diff-25badcef04942bfb7814284151c2b07081c94abb751d132748accbe147d327b6R44

In this case default working directory will be /projector/ide/bin as it provided by default from IntelliJ logic.

As for replacing environment variables. Each variable that is provided in workingDir parameter is replaced by the corresponding value from current environment. So in a few words, if environment has PROJECT_ROOT it will be replaced by the value from this variable. It performed by this object: https://github.com/che-incubator/jetbrains-editor-images/pull/78/files#diff-5055c3b1852b91d19343f6c99b512430a88843e017b5072bee67da69a432a017R16-R35 and it is called here: https://github.com/che-incubator/jetbrains-editor-images/pull/78/files#diff-25badcef04942bfb7814284151c2b07081c94abb751d132748accbe147d327b6R44

So it depends how user configured the parameter workingDir and what exactly contains in current environment.

@benoitf
Copy link
Contributor

benoitf commented Jan 29, 2022

no working directory in devfile, set workdir to PROJECT_SOURCE

@vzhukovs
Copy link
Collaborator Author

no working directory in devfile, set workdir to PROJECT_SOURCE

we can provide additional PR for this, after resolving eclipse-che/che#21079, because we haven't had this variable in environment yet

cc @azatsarynnyy

@benoitf
Copy link
Contributor

benoitf commented Jan 31, 2022

it's there since devfile/devworkspace-operator#697

@azatsarynnyy
Copy link
Member

... we haven't had this variable in environment yet

I have both:

PROJECTS_ROOT="/projects"
PROJECTS_SOURCE="/projects"

in my Che instance.

@azatsarynnyy
Copy link
Member

we can provide additional PR for this ...

@vzhukovs create an issue for that. So, we won't forget fixing that in the next iteration.

Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
@vzhukovs
Copy link
Collaborator Author

we can provide additional PR for this ...

@vzhukovs create an issue for that. So, we won't forget fixing that in the next iteration.

Created the issue: eclipse-che/che#21100

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

I can't test it on the Che dogfooding instance, as I get
image

@vzhukovs what instance have you used for testing?

@azatsarynnyy
Copy link
Member

I've also tried on RHPDS. The Dashboard logs:

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Detected unrecoverable event FailedMount: Unable to attach or mount volumes: unmounted volumes=[claim-devworkspace], unattached volumes=[claim-devworkspace workspace-metadata kube-api-access-k7tw9 che-gateway]: timed out waiting for the condition

@vzhukovs
Copy link
Collaborator Author

vzhukovs commented Feb 2, 2022

I've also tried on RHPDS. The Dashboard logs:

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Initializing DevWorkspace

Preparing networking

Networking ready

Waiting for DevWorkspace ServiceAccount

Waiting for workspace deployment

Detected unrecoverable event FailedMount: Unable to attach or mount volumes: unmounted volumes=[claim-devworkspace], unattached volumes=[claim-devworkspace workspace-metadata kube-api-access-k7tw9 che-gateway]: timed out waiting for the condition

Try to follow this steps:

$ minikube start --cpus=4 --memory=10000 --disk-size='35000mb'
$ chectl server:deploy --installer operator --platform minikube --batch --workspace-engine dev-workspace
$ eval $(minikube -p minikube docker-env)
$ docker pull quay.io/devfile/universal-developer-image:ubi8-eda6672
$ docker pull quay.io/vzhukovs/che-idea:che-21029

* start the workspace from the https://github.com/vzhukovs/che-21029 repository

@azatsarynnyy
Copy link
Member

The good news is that pre-pulling the UDI image really helped to avoid terminating the workspace start by timeout. 👍 Thanks for the advice!
That's another issue. I'll rise it internally.

I was able to start a DevWorkspace from https://github.com/vzhukovs/che-21029.
But there're no Run Configurations for the Devfile Commands:

image

Also, I've tried the link provided the PR description - https://<your-che-host>/dashboard/#https://github.com/che-samples/bash/tree/devfilev2?che-editor=https://gist.githubusercontent.com/vzhukovs/a32cafcd8d84d9af7579fcf4c09d4e31/raw/d58d87233d9b7facd6e5c6ca691679f072492e6a/devfile.yaml

And I've got the same result.

@azatsarynnyy
Copy link
Member

There's no plugin in the Plugins list:
image

@vzhukovs
Copy link
Collaborator Author

vzhukovs commented Feb 2, 2022

But there're no Run Configurations for the Devfile Commands

Prerequisites for appearing Run Configurations is finished project indexing. After that Run Configurations is become available. This is the limitation of IntelliJ IDEA.

The factory link from the description should be updated as it should contain the plugin before removing the preference page. So it not actual, will update the description. The correct repository for testing is:

https://github.com/vzhukovs/che-21029

This one was used to record the demo flow.

@vzhukovs
Copy link
Collaborator Author

vzhukovs commented Feb 2, 2022

There's no plugin in the Plugins list:

It should appear on Installed tab. The field, you've used is to look for plugins only in the marketplace.

Снимок экрана 2022-02-02 в 22 46 53

@azatsarynnyy
Copy link
Member

Prerequisites for appearing Run Configurations is finished project indexing. After that Run Configurations is become available. This is the limitation of IntelliJ IDEA.

After indexing the project, the Run Configurations were imported:
image

I was able to run/stop the commands.

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

Great job!

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

Successfully merging this pull request may close these issues.

Support running the Devfile commands by Che-IDEA
3 participants