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 #921

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

RomanNikitenko
Copy link
Contributor

What does this PR do?

Use post-start event instead of command to start VS Code
Upstream changes: eclipse-che/che-plugin-registry#1566

What issues does this PR fix or reference?

eclipse-che/che#21879

Release Notes

Docs PR (if applicable)

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 can't start with this editor:

Screenshot from 2023-03-22 10-13-39

I've tested it in this way:

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/e442bfbe8ef1a65278a470528c24daa7/raw/f63edfb7b95249d36e717e9299769c5a3be8bef9/review-che-code.yaml
      components:
        - name: che-code-runtime-description
          container:
            env:
              - name: CODE_HOST
                value: 0.0.0.0

where https://gist.githubusercontent.com/svor/e442bfbe8ef1a65278a470528c24daa7/raw/f63edfb7b95249d36e717e9299769c5a3be8bef9/review-che-code.yaml provides a content of the editor with the current changes, it was taken from https://pr-check-921-devspaces-plugin-registry.surge.sh/v3/plugins/che-incubator/che-code/latest/devfile.yaml

If I try to create a workspace with an upstream editor, it starts:
oc apply -f dw2.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

@RomanNikitenko is it expected?

@RomanNikitenko
Copy link
Contributor Author

RomanNikitenko commented Mar 22, 2023

@svor
I tested using this sample and it works for me well: https://gist.githubusercontent.com/RomanNikitenko/b3771f8ba1f15dee7460cf886b61dc77/raw/52ce51dac42fb3ae5c9ae30f32d46a9b599bbeea/VS_Code_DevWorkspace.yaml

Will compare what's a difference...

UPD: sorry, I have the similar PR for the upstream, so I tested it for upstream...
testing it for the devspaces now...

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:
Screenshot from 2023-03-22 11-03-25
with this DW:

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/e442bfbe8ef1a65278a470528c24daa7/raw/aecded5c28dbb6cf35f36f7fe91803ad66ef8cee/review-che-code.yaml
      components:
        - name: che-code-runtime-description
          container:
            env:
              - name: CODE_HOST
                value: 0.0.0.0

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.

2 participants