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

fix: [devworkpsce-handler] Move project section from editor devfile to user devfile #1271

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Dec 9, 2021

Signed-off-by: Igor Vinokur ivinokur@redhat.com

What does this PR do?

Move the generated projects section from the editor devfile to the user devfile.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

eclipse-che/che#20877

How to test this PR?

  1. Build the devworkspace-handler package
  2. Run node lib/entrypoint.js --devfile-url:https://github.com/che-samples/java-spring-petclinic/tree/devfilev2 --output-file:/Users/ivinokur/projects/che-theia/tools/devworkspace-handler/a.yaml in the package root and see the default projects section exists in the user devfile of thegenerated template.
  3. Run node lib/entrypoint.js --devfile-url:https://github.com/che-samples/java-spring-petclinic/tree/devfilev2 --output-file:/Users/ivinokur/projects/che-theia/tools/devworkspace-handler/a.yaml --project.name={{DEVFILE_REGISTRY_URL}}/project.zip and see the projects section with the specified projects in the zip format exists in the user devfile of thegenerated template.

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.

Happy Path Channel

HAPPY_PATH_CHANNEL=stable

…o user devfile

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
@codecov
Copy link

codecov bot commented Dec 9, 2021

Codecov Report

Merging #1271 (6c293b2) into main (c299f59) will increase coverage by 3.02%.
The diff coverage is 30.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1271      +/-   ##
==========================================
+ Coverage   32.78%   35.81%   +3.02%     
==========================================
  Files         290      324      +34     
  Lines        9885    10480     +595     
  Branches     1457     1356     -101     
==========================================
+ Hits         3241     3753     +512     
- Misses       6641     6723      +82     
- Partials        3        4       +1     
Impacted Files Coverage Δ
...theia-about/src/browser/about-che-theia-dialog.tsx 0.00% <0.00%> (ø)
...credentials/src/browser/che-credentials-service.ts 0.00% <0.00%> (ø)
...entials/src/browser/credentials-frontend-module.ts 0.00% <0.00%> (ø)
...eia-credentials/src/common/credentials-protocol.ts 0.00% <0.00%> (ø)
...eia-credentials/src/node/che-credentials-server.ts 0.00% <0.00%> (ø)
...s/src/node/che-theia-credentials-backend-module.ts 0.00% <0.00%> (ø)
...ashboard/src/browser/che-theia-dashboard-module.ts 0.00% <0.00%> (ø)
...ia-dashboard/src/browser/theia-dashboard-client.ts 0.00% <0.00%> (ø)
...rowser/src/browser/che-mini-browser-environment.ts 0.00% <0.00%> (ø)
...se-che-theia-plugin-ext/src/common/che-protocol.ts 100.00% <ø> (ø)
... and 266 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68f1e4e...6c293b2. Read the comment docs.

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.

LGTM

Generated DevWorkspace

apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspaceTemplate
metadata:
  name: theia-ide-spring-petclinic
spec:
  commands:
    - id: init-container-command
      apply:
        component: remote-runtime-injector
  events:
    preStart:
      - init-container-command
  components:
    - name: theia-ide
      container:
        image: quay.io/eclipse/che-theia:next
        env:
          - name: THEIA_PLUGINS
            value: local-dir:///plugins
          - name: HOSTED_PLUGIN_HOSTNAME
            value: 0.0.0.0
          - name: HOSTED_PLUGIN_PORT
            value: '3130'
          - name: THEIA_HOST
            value: 127.0.0.1
        volumeMounts:
          - name: plugins
            path: /plugins
          - name: theia-local
            path: /home/theia/.theia
        mountSources: true
        memoryLimit: 512M
        cpuLimit: 1500m
        cpuRequest: 100m
        endpoints:
          - name: theia
            attributes:
              type: main
              cookiesAuthEnabled: true
              discoverable: false
              urlRewriteSupported: true
            targetPort: 3100
            exposure: public
            secure: false
            protocol: https
          - name: webviews
            attributes:
              type: webview
              cookiesAuthEnabled: true
              discoverable: false
              unique: true
              urlRewriteSupported: true
            targetPort: 3100
            exposure: public
            secure: false
            protocol: https
          - name: mini-browser
            attributes:
              type: mini-browser
              cookiesAuthEnabled: true
              discoverable: false
              unique: true
              urlRewriteSupported: true
            targetPort: 3100
            exposure: public
            secure: false
            protocol: https
          - name: theia-dev
            attributes:
              type: ide-dev
              discoverable: false
              urlRewriteSupported: true
            targetPort: 3130
            exposure: public
            protocol: http
          - name: theia-redirect-1
            attributes:
              discoverable: false
              urlRewriteSupported: true
            targetPort: 13131
            exposure: public
            protocol: http
          - name: theia-redirect-2
            attributes:
              discoverable: false
              urlRewriteSupported: true
            targetPort: 13132
            exposure: public
            protocol: http
          - name: theia-redirect-3
            attributes:
              discoverable: false
              urlRewriteSupported: true
            targetPort: 13133
            exposure: public
            protocol: http
          - name: terminal
            attributes:
              type: collocated-terminal
              discoverable: false
              cookiesAuthEnabled: true
              urlRewriteSupported: true
            targetPort: 3333
            exposure: public
            secure: false
            protocol: wss
      attributes:
        app.kubernetes.io/component: che-theia
        app.kubernetes.io/part-of: che-theia.eclipse.org
    - name: plugins
      volume: {}
    - name: theia-local
      volume: {}
    - name: che-machine-exec
      container:
        image: quay.io/eclipse/che-machine-exec:next
        command:
          - /go/bin/che-machine-exec
          - '--url'
          - 127.0.0.1:3333
          - '--idle-timeout'
          - 15m
        memoryLimit: 128Mi
        memoryRequest: 32Mi
        cpuLimit: 500m
        cpuRequest: 30m
      attributes:
        app.kubernetes.io/component: machine-exec
        app.kubernetes.io/part-of: che-theia.eclipse.org
    - name: remote-runtime-injector
      container:
        image: quay.io/eclipse/che-theia-endpoint-runtime-binary:next
        env:
          - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
            value: /remote-endpoint/plugin-remote-endpoint
          - name: REMOTE_ENDPOINT_VOLUME_NAME
            value: remote-endpoint
        volumeMounts:
          - name: plugins
            path: /plugins
          - name: remote-endpoint
            path: /remote-endpoint
        memoryLimit: 128Mi
        memoryRequest: 32Mi
        cpuLimit: 500m
        cpuRequest: 30m
      attributes:
        app.kubernetes.io/component: remote-runtime-injector
        app.kubernetes.io/part-of: che-theia.eclipse.org
    - name: remote-endpoint
      volume:
        ephemeral: true
---
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
  name: spring-petclinic
spec:
  started: true
  template:
    attributes:
      che-theia.eclipse.org/sidecar-policy: USE_DEV_CONTAINER
    components:
      - name: tools
        container:
          image: quay.io/devfile/universal-developer-image:ubi8-d433ed6
          memoryLimit: 3Gi
          endpoints:
            - exposure: none
              name: debug
              protocol: tcp
              targetPort: 5005
            - exposure: public
              name: 8080-tcp
              protocol: http
              targetPort: 8080
          volumeMounts:
            - name: m2
              path: /home/user/.m2
            - path: /remote-endpoint
              name: remote-endpoint
            - path: /plugins
              name: plugins
          env:
            - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
              value: /remote-endpoint/plugin-remote-endpoint
            - name: THEIA_PLUGINS
              value: local-dir:///plugins/sidecars/tools
          args:
            - sh
            - '-c'
            - ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
        attributes:
          che-theia.eclipse.org/vscode-extensions:
            - >-
              https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.75.0-60.vsix
            - >-
              https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-java-debug/vscode-java-debug-0.26.0.vsix
            - >-
              https://open-vsx.org/api/vscjava/vscode-java-test/0.28.1/file/vscjava.vscode-java-test-0.28.1.vsix
          che-theia.eclipse.org/vscode-preferences:
            java.server.launchMode: Standard
          app.kubernetes.io/name: tools
      - name: m2
        volume:
          size: 1G
      - name: mysql
        container:
          image: >-
            quay.io/eclipse/che--centos--mysql-57-centos7:latest-e08ee4d43b7356607685b69bde6335e27cf20c020f345b6c6c59400183882764
          memoryLimit: 300Mi
          endpoints:
            - exposure: none
              name: db
              protocol: tcp
              targetPort: 3306
          env:
            - name: MYSQL_USER
              value: petclinic
            - name: MYSQL_PASSWORD
              value: petclinic
            - name: MYSQL_DATABASE
              value: petclinic
            - name: PS1
              value: $(echo ${0})\\$
      - name: theia-ide-spring-petclinic
        plugin:
          kubernetes:
            name: theia-ide-spring-petclinic
    commands:
      - id: prepare-database
        exec:
          component: mysql
          workingDir: ${PROJECTS_ROOT}/java-spring-petclinic
          commandLine: >
            /opt/rh/rh-mysql57/root/usr/bin/mysql -u root <
            ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/user.sql
            && \

            /opt/rh/rh-mysql57/root/usr/bin/mysql -u root petclinic <
            ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/schema.sql
            && \

            /opt/rh/rh-mysql57/root/usr/bin/mysql -u root petclinic <
            ${PROJECTS_ROOT}/java-spring-petclinic/src/main/resources/db/mysql/data.sql
            && \

            echo -e "\e[32mDone.\e[0m Database petclinic was configured"
          group:
            kind: run
            isDefault: true
      - id: build
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/java-spring-petclinic
          commandLine: mvn clean install
          group:
            kind: build
            isDefault: true
      - id: run-with-hsqldb
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/java-spring-petclinic
          commandLine: java -jar target/*.jar
          group:
            kind: run
            isDefault: true
      - id: run-with-mysql
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/java-spring-petclinic
          commandLine: >
            java -jar -Dspring-boot.run.profiles=mysql \

            -Xdebug
            -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 \

            target/*.jar
          group:
            kind: run
            isDefault: true
      - id: run-debug
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/java-spring-petclinic
          commandLine: >-
            java -jar -Xdebug
            -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
            target/*.jar
          group:
            kind: run
            isDefault: true
    projects:
      - name: java-spring-petclinic
        git:
          remotes:
            origin: https://github.com/che-samples/java-spring-petclinic.git
          checkoutFrom:
            revision: devfilev2

@che-bot
Copy link
Contributor

che-bot commented Dec 9, 2021

❌ E2E Happy path tests failed ❗

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia quay.io/crw_pr/che-theia:1271
che-theia-endpoint-runtime-binary quay.io/crw_pr/che-theia-endpoint-runtime-binary:1271

Test product:

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

Eclipse Che QE channel: https://mattermost.eclipse.org/eclipse/channels/eclipse-che-qe

@benoitf
Copy link
Contributor

benoitf commented Dec 9, 2021

happy path is working in github actions

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.

4 participants