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

feat: Use post-start event to start VS Code #1566

Merged
merged 1 commit into from
Mar 22, 2023
Merged

Conversation

RomanNikitenko
Copy link
Member

@RomanNikitenko RomanNikitenko commented Feb 1, 2023

depends on: #1613

What does this PR do?

Use post-start event instead of command to start VS Code

What issues does this PR fix or reference?

eclipse-che/che#21879

How to test this PR?

We should check that VS Code starts successfully after resolving devfile/devworkspace-operator#1029

I tested it like:

The sample contains the corresponding changes for the editor description.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

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

@openshift-ci
Copy link

openshift-ci bot commented Feb 1, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Click here to review and test in web IDE: Contribute

1 similar comment
@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Click here to review and test in web IDE: Contribute

@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Merging #1566 (74b8114) into main (d874c08) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 74b8114 differs from pull request most recent head ebf56c6. Consider uploading reports for the commit ebf56c6 to get more accurate results

@@           Coverage Diff           @@
##             main    #1566   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files          47       47           
  Lines        1457     1457           
  Branches      253      253           
=======================================
  Hits         1365     1365           
  Misses         92       92           
Impacted Files Coverage Δ
...ols/build/src/devfile/meta-yaml-to-devfile-yaml.ts 100.00% <100.00%> (ø)
...uild/src/editor/che-editors-meta-yaml-generator.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@RomanNikitenko

This comment was marked as duplicate.

events:
preStart:
- init-container-command
postStart:
- init-che-code-command
Copy link
Member Author

@RomanNikitenko RomanNikitenko Feb 16, 2023

Choose a reason for hiding this comment

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

The main idea is - initialization of the che-code on the post-start event vs execution entrypoint as a command to avoid overriding the UDI entrypoint.

I've tested creation of a workspace for the VS Code editor without Dashboard usage and I can confirm that the UDI entrypoint is not overridden anymore if I use these changes for the description of the editor.

At the same time there is still a problem when I create a workspace from the dashboard. So - I guess:

  • logic on the DWO side works correctly
  • we still need some changes on the dashboard side

I guess resolving this issue should fix the problem on the dashboard side.
So, let's keep the PR still as a draft.

Copy link
Member Author

@RomanNikitenko RomanNikitenko Mar 3, 2023

Choose a reason for hiding this comment

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

I tested it using this sample, it contains the same changes for the editor description.
It works well after merging the corresponding changes on the dashboard side.

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

Click here to review and test in web IDE: Contribute

@RomanNikitenko RomanNikitenko changed the title Use post-start event to start VS Code feat: Use post-start event to start VS Code Mar 3, 2023
@RomanNikitenko RomanNikitenko marked this pull request as ready for review March 3, 2023 13:03
Copy link
Contributor

@svor svor left a comment

Choose a reason for hiding this comment

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

Final editor's devfile.yaml doesn't contain postStart command: it could be checked in published PR's content in surge:
screenshot-github com-2023 03 06-10_22_01

To fix it, need to change this logic: https://github.com/eclipse-che/che-plugin-registry/blob/main/tools/build/src/devfile/meta-yaml-to-devfile-yaml.ts#L170-L203

@RomanNikitenko
Copy link
Member Author

Final editor's devfile.yaml doesn't contain postStart command: it could be checked in published PR's content in surge

To fix it, need to change this logic: https://github.com/eclipse-che/che-plugin-registry/blob/main/tools/build/src/devfile/meta-yaml-to-devfile-yaml.ts#L170-L203

thank you very much, Valerii, for the reviewing my PR!
I was not aware about that logic and just tested my changes as I described in #1566 (comment).

At the moment I have to switch to another blocker issue, I'm going to come back soon to investigate that logic and provide the corresponding changes...

@github-actions
Copy link

Click here to review and test in web IDE: Contribute

1 similar comment
@github-actions
Copy link

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Click here to review and test in web IDE: Contribute

@RomanNikitenko
Copy link
Member Author

RomanNikitenko commented Mar 20, 2023

@svor
I created a separate issue for the problem you mentioned in #1566 (review).

The issue: eclipse-che/che#22071
The PR with fix: #1613

Copy link
Contributor

@svor svor left a comment

Choose a reason for hiding this comment

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

@openshift-ci openshift-ci bot added the lgtm label Mar 21, 2023
@svor
Copy link
Contributor

svor commented Mar 21, 2023

/retest

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

eclipse-che/che#21879

thank you for the prompt!
Done: redhat-developer/devspaces#921

Copy link
Contributor

@svor svor left a comment

Choose a reason for hiding this comment

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

A workspace has started with che-code editor and current changes:
Screenshot from 2023-03-22 10-20-36

tested with:
oc apply -f dw.yaml
where dw.yaml is:

kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: git-clone-sample-devworkspace
spec:
  started: true
  template:
    projects:
      - name: web-nodejs-sample
        git:
          remotes:
            origin: "https://github.com/che-samples/web-nodejs-sample.git"
    commands:
      - id: say-hello
        exec:
          component: che-code-runtime-description
          commandLine: echo "Hello from $(pwd)"
          workingDir: ${PROJECT_SOURCE}/app
  contributions:
    - name: che-code
      uri: https://gist.githubusercontent.com/svor/272c56c4aab0468a6079ac932d562a75/raw/6fa7505409e93cabf11e73d2c70478db6d43c07e/che-code2.yaml
      components:
        - name: che-code-runtime-description
          container:
            env:
              - name: CODE_HOST
                value: 0.0.0.0

@openshift-ci openshift-ci bot added the lgtm label Mar 22, 2023
@openshift-ci
Copy link

openshift-ci bot commented Mar 22, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: RomanNikitenko, svor

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@RomanNikitenko RomanNikitenko merged commit e30461c into main Mar 22, 2023
@RomanNikitenko RomanNikitenko deleted the post-start-event branch March 22, 2023 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants