Eclipse Che 7: New & Noteworthy
Total Page:16
File Type:pdf, Size:1020Kb
Eclipse Che 7: New & Noteworthy Florent Benoit 1 Introduction to Eclipse Che 7 Eclipse Che 2 Development time spent on configuration and setup Activities that require configuration and setup: - Onboarding on a new project Config and Setup - Switching between different projects, technologies 24% - Fixing a maintenance branch of a dev team’s week is spent on - Reviewing a pull request building and maintaining developer environments - Upgrading tools, plugins, dependencies - Trying out a new technology 3 Anyone, anytime can contribute to a project without installing software. The developer contribution journey Scaffold Config and Setup Configure dependencies Code Dev Build Run Test Debug Integrate Feedback Optimize Consistency, reproducibility, and ease of access is a velocity factor TRADITIONAL LAPTOP APPROACH Shareable Project sources with all Dependencies Developer Tools: language servers, debuggers, testing tools, security tools, etc... Shareable Commands with some Build and packaging tools Terminal Operating system Hard to share with Web server / application server anyone Database (All other runtime components) A laptop makes it hard to share and secure everything a developer needs. 6 Defining a new kind of workspace > ……………………… …………………………………………… ………………………………....> ……………………… …………………………………………… ………………………………....{ Main void function() ………….. } Source Code IDE Tools Runtime Env Eclipse Che Workspace New Editor 8 NEW EDITOR New editor: Eclipse Theia Containerizing the IDE: zero install and automate configuration Extended Eclipse Theia, to provide a VSCode-like experience Built-in: ⌁ Languages Server Protocol ⌁ Debug Adapter Protocol Compatible with VSCode extensions 9 NEW EDITOR Customize with VSCode extensions ● Visual Studio Code extensions compatibility ● Extensions packaged with their dependencies ● Plug-in registry with predefined set of plug-ins 10 NEW EDITOR Enriched Developer Experience ● Keyboard Navigation: Command Palette ● Rich Editor ○ Find/Replace instances ○ Peek Definition ○ Outline ● Improved Debug ● Simple Git Plugin ● Layout customization ● Theming ● Port detection Plugin 11 Swappable Editor 12 Che 7: swappable editor 13 Devfile 14 DEVFILE Devfile: Developer environment as code Project Name Repo Branch The devfile provides easy-to-configure, highly reproducible IDE definitions of portable developer environments. Tools It is a declarative abstraction of a replicable developer Runtime Env workspaces, which includes the runtime environments, the Build Env source code of the projects mapped to repositories and the Commands tools, plugins and commands needed to code, build, test, run Build Run Debug and debug a project. Devfile Definition --- DEVFILE apiVersion: 1.0.0 metadata: generateName: java-web-vertx- 1 projects: - name: java-web-vertx source: Devfile Example type: git location: "https://github.com/che-samples/web-java-vertx" 2 components: 3 - type: chePlugin 1 Project information id: redhat/java/latest 4 - type: dockerimage 2 List of components of the workspace alias: maven image: quay.io/eclipse/che-java8-maven:nightly 3 Plugin component 5 env: - name: JAVA_OPTS 4 Runtime image value: "-Duser.home=/home/user" - name: MAVEN_OPTS 5 Env variables to configure the container value: $(JAVA_OPTS) memoryLimit: 512Mi 6 6 End-points definition endpoints: - name: '8080/tcp' port: 8080 mountSources: true 16 volumes: - name: m2 containerPath: /home/user/.m2 Devfile: Made for Team Manage Consistency Easy to Integrate Simple to Share Extensible First class support of K8S, Devfiles are easy to Devfile live with source Customize per task, with manage the complexity of integrate with any tools. code, are easy to modify, plug-in and developer developer environments Developer environments fork and share. preferences take out the pain. can be created from anywhere at anytime. 17 2019 RED HAT TECH EXCHANGE CONFIDENTIAL INTERNAL USE DEMO #1 18 Photo by Unsplash Stack and Plug-ins Registries 19 OPENSHIFT 4.2 Stack and Plug-ins Registries Tools Registry Devfile Registry In-house deployment Provide ready-to-use developer stacks Define plug-ins Manage stacks Define IDEs 20 Che 7: registries Registries in Eclipse Che plug-in registry devfile registry workspace 21 Theia IDE and plug-ins Manage all plugins including VS Code extensions 22 Develop VS Code extensions Develop VS Code extensions 23 VS Code extensions How to start ? Scaffolding: Yeoman generator yo code Develop Intellisense from Eclipse Che IDE Run Run inside Eclipse Che IDE Debug Run inside Eclipse Che IDE 24 VS Code extensions hosted mode Hosted / development mode Browser Che / Theia Container Theia IDE Serves Main Theia (plugin source) Server Hosted Mode Serves Hosted Theia (running plugin) Server Two instances of Theia ● Main instance to write plug-ins ● A new instance to run plug-ins 25 2019 RED HAT TECH EXCHANGE CONFIDENTIAL INTERNAL USE DEMO #2 Develop and debug VSCode extension youtube 26 Photo by Unsplash Develop VS Code extensions Publish VS Code extensions on Eclipse Che registries 27 Che 7: registries Registries in Eclipse Che plug-in registry devfile registry workspace 28 Devfile --- apiVersion: 1.0.0 metadata: name: my-che-workspace components: - type: chePlugin id: redhat/java11/latest plug-in registry devfile 29 https://che-plugin-registry.openshift.io/v3/plugins/ Devfile and registries --- apiVersion: 1.0.0 metadata: name: my-che-workspace components: - type: chePlugin che plug-in registry - reference: https://my-registry/plugins/florent/hello/0.1/meta.yaml devfile my registry 30 Create its own registry Build a custom registry based on existing one ● Add / update / remove plug-ins ● Rebuild docker image 31 Create its own registry on github Or use a simple github project 32 2019 RED HAT TECH EXCHANGE CONFIDENTIAL INTERNAL USE DEMO #3 VSCode extension with custom plugin registry youtube33 Photo by Unsplash VS Code extensions and Eclipse Che VS Code extensions and Eclipse Che 34 BENEFITS ECLIPSE CHE Eclipse Che Workspaces Multi-user / auth plug-ins per workspace OpenID Connect / LDAP / Keycloak Plug-in Registry Cloud Ready Global / per instance Kubernetes / OpenShift 35 Custom namespace @eclipse-che/plugin namespace ● Interact easily with Eclipse Che API https://github.com/eclipse/che-theia/blob/master/extensions/eclipse-che-theia-plugin/src/che-pr oposed.d.ts export namespace workspace { export function getCurrentWorkspace(): Promise<cheApi.workspace.Workspace>; export function getAll(): Promise<cheApi.workspace.Workspace[]>; export function getAllByNamespace(namespace: string): Promise<cheApi.workspace.Workspace[]>; export function getById(workspaceId: string): Promise<cheApi.workspace.Workspace>; export function create(config: cheApi.workspace.WorkspaceConfig, params: KeyValue): Promise<any>; export function update(workspaceId: string, workspace: cheApi.workspace.Workspace): Promise<any>; export function deleteWorkspace(workspaceId: string): Promise<any>; export function start(workspaceId: string, environmentName: string): Promise<any>; export function startTemporary(config: cheApi.workspace.WorkspaceConfig): Promise<any>; export function stop(workspaceId: string): Promise<any>; export function getSettings(): Promise<KeyValue>; } ● Simple code to use import * as che from '@eclipse-che/plugin'; 36 ... await che.workspace.getCurrentWorkspace(); EXTERNAL PLUG-IN DEPENDENCIES System Runtime dependencies / Language server protocol Java LSP needs Java, PHP requires PHP, etc Tools dependencies $ apt-get install / yum install Native libraries 37 PLUG-IN RUNTIME ECLIPSE CHE Standalone VS Code Eclipse Che with containers Java 11 Java 13 container container Plugin 1 Plugin 2 VS Code Che IDE Che IDE Endpoint Endpoint Plugin1 PluginN JSON RPC Main IDE Container Plugin 3 Java installed on your system 38 How sidecar endpoint is working ? Che Remote Theia endpoint FROM eclipse/che-theia-endpoint-runtime:next RUN apk --no-cache add openjdk11 -repository=http://dl-cdn.alpinelinux.org/alpine/edge/community ENV JAVA_HOME /usr/lib/jvm/default-jvm/ FROM eclipse/che-theia-endpoint-runtime:next RUN apk --no-cache add fortune 39 How sidecar endpoint is working ? Che Remote Theia endpoint : some limitations ● Needs to inherit from a dedicated Docker image ● Workaround with multi-staged builds ● Strong link between Theia image and sidecar images ○ (better to use same version of theia on main theia and sidecars) 40 How sidecar endpoint is working ? Che Remote Theia endpoint : some limitations ● Needs to inherit from a dedicated Docker image ● Workaround with multi-staged builds ● Strong link between Theia image and sidecar images ○ (better to use same version of theia on main theia and sidecars) 41 How sidecar endpoint is working ? Upcoming Eclipse Che 7.4 : endpoint improvements ● Create a single all-in-one binary for this endpoint ○ Using nexe tool on Eclipse Che Theia remote package ● Copy this binary and run it ● Allow to use existing dockers image from docker registries FROM docker.io/openjdk:14-alpine ● ⇒ no need to build images, use image name in plugin’s meta.yaml 42 Custom runtime Use a custom runtime for a VS Code extension : meta.yaml apiVersion: v2 publisher: redhat name: vscode-xml version: latest type: VS Code extension displayName: XML title: XML Language Support by Red Hat description: This VS Code extension provides support for creating and editing XML documents, based on the LSP4XML language server, running with Java. icon: https://www.eclipse.org/che/images/logo-eclipseche.svg repository: https://github.com/redhat-developer/vscode-xml category: Language firstPublicationDate: '2019-04-19' spec: