-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ide] Add JetBrains IDE images #6367
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
packages: | ||
- name: docker | ||
type: generic | ||
argdeps: | ||
- version | ||
deps: | ||
- :intellij | ||
- :goland | ||
- name: intellij | ||
type: docker | ||
srcs: | ||
- "startup.sh" | ||
- "supervisor-ide-config_intellij.json" | ||
- "status/go.mod" | ||
- "status/main.go" | ||
deps: | ||
- components/ide/jetbrains/backend-plugin:plugin | ||
argdeps: | ||
- imageRepoBase | ||
- INTELLIJ_BACKEND_URL | ||
config: | ||
dockerfile: leeway.Dockerfile | ||
metadata: | ||
helm-component: workspace.desktopIdeImages.intellij | ||
buildArgs: | ||
JETBRAINS_BACKEND_URL: ${INTELLIJ_BACKEND_URL} | ||
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_intellij.json | ||
image: | ||
- ${imageRepoBase}/ide/intellij:${version} | ||
- ${imageRepoBase}/ide/intellij:commit-${__git_commit} | ||
- name: goland | ||
type: docker | ||
srcs: | ||
- "startup.sh" | ||
- "supervisor-ide-config_goland.json" | ||
- "status/go.mod" | ||
- "status/main.go" | ||
deps: | ||
- components/ide/jetbrains/backend-plugin:plugin | ||
argdeps: | ||
- imageRepoBase | ||
- GOLAND_BACKEND_URL | ||
config: | ||
dockerfile: leeway.Dockerfile | ||
metadata: | ||
helm-component: workspace.desktopIdeImages.goland | ||
buildArgs: | ||
JETBRAINS_BACKEND_URL: ${GOLAND_BACKEND_URL} | ||
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_goland.json | ||
image: | ||
- ${imageRepoBase}/ide/goland:${version} | ||
- ${imageRepoBase}/ide/goland:commit-${__git_commit} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
# Licensed under the GNU Affero General Public License (AGPL). | ||
# See License-AGPL.txt in the project root for license information. | ||
|
||
FROM golang:1.17 AS build | ||
WORKDIR /app | ||
COPY status/* /app/ | ||
RUN go build -o status | ||
|
||
FROM alpine:3.14 as download | ||
ARG JETBRAINS_BACKEND_URL | ||
WORKDIR /workdir | ||
RUN apk add --no-cache --upgrade curl gzip tar unzip | ||
RUN curl -sSLo backend.tar.gz "$JETBRAINS_BACKEND_URL" && tar -xf backend.tar.gz --strip-components=1 && rm backend.tar.gz | ||
COPY --chown=33333:33333 components-ide-jetbrains-backend-plugin--plugin/build/distributions/jetbrains-backend-plugin-1.0-SNAPSHOT.zip /workdir | ||
RUN unzip jetbrains-backend-plugin-1.0-SNAPSHOT.zip -d plugins/ && rm jetbrains-backend-plugin-1.0-SNAPSHOT.zip | ||
|
||
FROM scratch | ||
ARG SUPERVISOR_IDE_CONFIG | ||
COPY --chown=33333:33333 ${SUPERVISOR_IDE_CONFIG} /ide-desktop/supervisor-ide-config.json | ||
COPY --chown=33333:33333 startup.sh /ide-desktop/ | ||
COPY --chown=33333:33333 --from=build /app/status /ide-desktop/ | ||
COPY --chown=33333:33333 --from=download /workdir/ /ide-desktop/backend/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash -li | ||
# Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
# Licensed under the GNU Affero General Public License (AGPL). | ||
# See License-AGPL.txt in the project root for license information. | ||
|
||
set -euo pipefail | ||
|
||
# kill background jobs when the script exits | ||
trap "jobs -p | xargs -r kill" SIGINT SIGTERM EXIT | ||
|
||
/ide-desktop/status 24000 "$1" & | ||
|
||
export CWM_NON_INTERACTIVE=1 | ||
export CWM_HOST_PASSWORD=gitpod | ||
export CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod | ||
/ide-desktop/backend/bin/remote-dev-server.sh cwmHost "$GITPOD_REPO_ROOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/gitpod-io/gitpod/jetbrains/status | ||
|
||
go 1.17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io/ioutil" | ||
"log" | ||
"net/http" | ||
"os" | ||
"time" | ||
) | ||
|
||
// proxy for the Code With Me status endpoints that transforms it into the supervisor status format. | ||
func main() { | ||
if len(os.Args) < 2 { | ||
fmt.Printf("Usage: %s <port> [<link label>]\n", os.Args[0]) | ||
os.Exit(1) | ||
} | ||
port := os.Args[1] | ||
label := "Open JetBrains IDE" | ||
if len(os.Args) > 2 { | ||
label = os.Args[2] | ||
} | ||
|
||
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) { | ||
var ( | ||
url = "http://localhost:63342/codeWithMe/unattendedHostStatus?token=gitpod" | ||
client = http.Client{Timeout: 1 * time.Second} | ||
) | ||
resp, err := client.Get(url) | ||
if err != nil { | ||
http.Error(w, err.Error(), http.StatusServiceUnavailable) | ||
return | ||
} | ||
defer resp.Body.Close() | ||
|
||
bodyBytes, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
http.Error(w, err.Error(), http.StatusServiceUnavailable) | ||
return | ||
} | ||
|
||
if resp.StatusCode != http.StatusOK { | ||
// log.Printf("Desktop IDE status proxy: getting non-200 status - %d\n%s\n", resp.StatusCode, bodyBytes) | ||
http.Error(w, string(bodyBytes), resp.StatusCode) | ||
return | ||
} | ||
|
||
type Projects struct { | ||
JoinLink string `json:"joinLink"` | ||
} | ||
type Response struct { | ||
Projects []Projects `json:"projects"` | ||
} | ||
jsonResp := &Response{} | ||
err = json.Unmarshal(bodyBytes, &jsonResp) | ||
|
||
if err != nil { | ||
http.Error(w, "Error parsing JSON body from IDE status probe.", http.StatusServiceUnavailable) | ||
return | ||
} | ||
if len(jsonResp.Projects) != 1 { | ||
http.Error(w, "projects size != 1", http.StatusServiceUnavailable) | ||
return | ||
} | ||
response := make(map[string]string) | ||
response["link"] = jsonResp.Projects[0].JoinLink | ||
response["label"] = label | ||
w.Header().Set("Content-Type", "application/json") | ||
json.NewEncoder(w).Encode(response) | ||
}) | ||
|
||
fmt.Printf("Starting status proxy for desktop IDE at port %s\n", port) | ||
if err := http.ListenAndServe(fmt.Sprintf(":%s", port), nil); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
components/ide/jetbrains/image/supervisor-ide-config_goland.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"entrypoint": "/ide-desktop/startup.sh", | ||
"entrypointArgs": [ "Open GoLand IDE" ], | ||
"readinessProbe": { | ||
"type": "http", | ||
"http": { | ||
"port": 24000, | ||
"path": "/status" | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
components/ide/jetbrains/image/supervisor-ide-config_intellij.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"entrypoint": "/ide-desktop/startup.sh", | ||
"entrypointArgs": [ "Open IntelliJ IDEA IDE" ], | ||
"readinessProbe": { | ||
"type": "http", | ||
"http": { | ||
"port": 24000, | ||
"path": "/status" | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for simplifying, now it is readable!