Skip to content

Commit c6e8671

Browse files
[ide] Add JetBrains IDE images
1 parent 911541c commit c6e8671

15 files changed

+237
-4
lines changed

.werft/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ export async function build(context, version) {
148148
if (withContrib || publishRelease) {
149149
exec(`leeway build --docker-build-options network=host --werft=true -c remote ${dontTest ? '--dont-test' : ''} -Dversion=${version} -DimageRepoBase=${imageRepo} contrib:all`);
150150
}
151-
exec(`leeway build --docker-build-options network=host --werft=true -c remote ${retag} --coverage-output-path=${coverageOutput} -Dversion=${version} -DremoveSources=false -DimageRepoBase=${imageRepo} -DlocalAppVersion=${localAppVersion} -DnpmPublishTrigger=${publishToNpm ? Date.now() : 'false'}`);
151+
const jetbrainsArgs = `-DINTELLIJ_PLUGIN_PLATFORM_VERSION=${process.env.INTELLIJ_PLUGIN_PLATFORM_VERSION} -DINTELLIJ_BACKEND_URL=${process.env.INTELLIJ_BACKEND_URL} -DGOLAND_BACKEND_URL=${process.env.GOLAND_BACKEND_URL}`;
152+
exec(`leeway build --docker-build-options network=host --werft=true -c remote ${retag} --coverage-output-path=${coverageOutput} -Dversion=${version} -DremoveSources=false -DimageRepoBase=${imageRepo} -DlocalAppVersion=${localAppVersion} ${jetbrainsArgs} -DnpmPublishTrigger=${publishToNpm ? Date.now() : 'false'}`);
152153
if (publishRelease) {
153154
try {
154155
werft.phase("publish", "checking version semver compliance...");

.werft/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ pod:
138138
secretKeyRef:
139139
name: codecov
140140
key: token
141+
envFrom:
142+
- secretRef:
143+
name: jetbrains-secrets
141144
command:
142145
- bash
143146
- -c

chart/templates/blobserve-configmap.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ data:
2626
"prePull": ["{{- template "gitpod.comp.version" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.theiaImage) -}}"],
2727
"workdir": "/theia/theia-app/app/lib"
2828
},
29+
"{{ template "gitpod.comp.imageRepo" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.desktopIdeImages.intellij) }}": {
30+
"prePull": ["{{- template "gitpod.comp.version" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.desktopIdeImages.intellij) -}}"],
31+
"workdir": "/ide-desktop"
32+
},
33+
"{{ template "gitpod.comp.imageRepo" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.desktopIdeImages.goland) }}": {
34+
"prePull": ["{{- template "gitpod.comp.version" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.desktopIdeImages.goland) -}}"],
35+
"workdir": "/ide-desktop"
36+
},
2937
"{{ template "gitpod.comp.imageRepo" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.codeImage) }}": {
3038
"prePull": ["{{- template "gitpod.comp.version" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.codeImage) -}}"],
3139
"workdir": "/ide",

chart/templates/server-ide-configmap.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@
1818
{{ template "gitpod.comp.imageRepo" . }}:{{- $comp.insidersVersion | default (include "gitpod.comp.version" .) -}}
1919
{{- end -}}
2020

21+
{{- define "ide-images-aliases"}}
22+
{{- $ := .root -}}
23+
{{- $gp := .gp -}}
24+
code: {{ (include "stable-image-full" (dict "root" $ "gp" $gp "comp" $gp.components.workspace.codeImage)) }}
25+
code-latest: {{ (include "insider-image-full" (dict "root" $ "gp" $gp "comp" $gp.components.workspace.codeImage)) }}
26+
{{ end }}
27+
28+
{{- define "desktop-ide-images-aliases"}}
29+
{{- $ := .root -}}
30+
{{- $gp := .gp -}}
31+
intellij: {{ (include "gitpod.comp.imageFull" (dict "root" $ "gp" $gp "comp" $gp.components.workspace.desktopIdeImages.intellij)) }}
32+
goland: {{ (include "gitpod.comp.imageFull" (dict "root" $ "gp" $gp "comp" $gp.components.workspace.desktopIdeImages.goland)) }}
33+
{{ end }}
34+
2135
{{- if $comp.serverIdeConfigDeploy.enabled }}
2236
apiVersion: v1
2337
kind: ConfigMap
@@ -33,6 +47,7 @@ data:
3347
{
3448
"ideVersion": "{{ .Values.components.workspace.codeImage.stableVersion }}",
3549
"ideImageRepo": "{{ template "gitpod.comp.imageRepo" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.codeImage) }}",
36-
"ideImageAliases": {{ (dict "code-latest" (include "insider-image-full" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.codeImage)) "code" (include "stable-image-full" (dict "root" . "gp" $.Values "comp" .Values.components.workspace.codeImage))) | toJson }}
50+
"ideImageAliases": {{ (include "ide-images-aliases" (dict "root" . "gp" $.Values)) | fromYaml | toJson }},
51+
"desktopIdeImageAliases": {{ (include "desktop-ide-images-aliases" (dict "root" . "gp" $.Values)) | fromYaml | toJson }}
3752
}
3853
{{- end }}

chart/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@ components:
401401
imageName: "ide/code"
402402
stableVersion: "commit-7107fb8bde0b1f92265402ad5fa09a51022b14dd"
403403
insidersVersion: "nightly"
404+
desktopIdeImages:
405+
intellij:
406+
imageName: "ide/intellij"
407+
goland:
408+
imageName: "ide/goland"
404409
supervisor:
405410
imageName: "supervisor"
406411
dockerUp:

components/BUILD.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ packages:
1414
- dev:all-app
1515
- installer:app
1616
- components/gitpod-protocol:all
17-
- components/ide/jetbrains/backend-plugin:plugin
1817
- operations/observability/mixins:lint
1918
- name: docker-versions
2019
type: docker
@@ -41,6 +40,8 @@ packages:
4140
- components/ee/ws-scheduler:docker
4241
- components/gitpod-db:docker
4342
- components/ide/code:docker
43+
- components/ide/jetbrains/image:intellij
44+
- components/ide/jetbrains/image:goland
4445
- components/ide/theia:docker
4546
- components/image-builder:docker
4647
- components/image-builder-mk3:docker

components/ide/jetbrains/backend-plugin/.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</natures>
2323
<filteredResources>
2424
<filter>
25-
<id>1634286379907</id>
25+
<id>0</id>
2626
<name></name>
2727
<type>30</type>
2828
<matcher>

components/ide/jetbrains/backend-plugin/BUILD.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ packages:
1111
- "gradle/wrapper/*"
1212
- "gradlew"
1313
- "settings.gradle.kts"
14+
argdeps:
15+
- INTELLIJ_PLUGIN_PLATFORM_VERSION
1416
env:
1517
- JAVA_HOME=/home/gitpod/.sdkman/candidates/java/current
18+
- INTELLIJ_PLUGIN_PLATFORM_VERSION=${INTELLIJ_PLUGIN_PLATFORM_VERSION}
1619
config:
1720
commands:
1821
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
packages:
2+
- name: docker
3+
type: generic
4+
argdeps:
5+
- version
6+
deps:
7+
- :intellij
8+
- :goland
9+
- name: intellij
10+
type: docker
11+
srcs:
12+
- "startup.sh"
13+
- "supervisor-ide-config_intellij.json"
14+
- "status/go.mod"
15+
- "status/main.go"
16+
deps:
17+
- components/ide/jetbrains/backend-plugin:plugin
18+
argdeps:
19+
- imageRepoBase
20+
- INTELLIJ_BACKEND_URL
21+
config:
22+
dockerfile: leeway.Dockerfile
23+
metadata:
24+
helm-component: workspace.desktopIdeImages.intellij
25+
buildArgs:
26+
JETBRAINS_BACKEND_URL: ${INTELLIJ_BACKEND_URL}
27+
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_intellij.json
28+
image:
29+
- ${imageRepoBase}/ide/intellij:${version}
30+
- ${imageRepoBase}/ide/intellij:commit-${__git_commit}
31+
- name: goland
32+
type: docker
33+
srcs:
34+
- "startup.sh"
35+
- "supervisor-ide-config_goland.json"
36+
- "status/go.mod"
37+
- "status/main.go"
38+
deps:
39+
- components/ide/jetbrains/backend-plugin:plugin
40+
argdeps:
41+
- imageRepoBase
42+
- GOLAND_BACKEND_URL
43+
config:
44+
dockerfile: leeway.Dockerfile
45+
metadata:
46+
helm-component: workspace.desktopIdeImages.goland
47+
buildArgs:
48+
JETBRAINS_BACKEND_URL: ${GOLAND_BACKEND_URL}
49+
SUPERVISOR_IDE_CONFIG: supervisor-ide-config_goland.json
50+
image:
51+
- ${imageRepoBase}/ide/goland:${version}
52+
- ${imageRepoBase}/ide/goland:commit-${__git_commit}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2+
# Licensed under the GNU Affero General Public License (AGPL).
3+
# See License-AGPL.txt in the project root for license information.
4+
5+
FROM golang:1.17 AS build
6+
WORKDIR /app
7+
COPY status/* /app/
8+
RUN go build -o status
9+
10+
FROM alpine:3.14 as download
11+
ARG JETBRAINS_BACKEND_URL
12+
WORKDIR /workdir
13+
RUN apk add --no-cache --upgrade curl gzip tar unzip
14+
RUN curl -sSLo backend.tar.gz "$JETBRAINS_BACKEND_URL" && tar -xf backend.tar.gz --strip-components=1 && rm backend.tar.gz
15+
COPY --chown=33333:33333 components-ide-jetbrains-backend-plugin--plugin/build/distributions/jetbrains-backend-plugin-1.0-SNAPSHOT.zip /workdir
16+
RUN unzip jetbrains-backend-plugin-1.0-SNAPSHOT.zip -d plugins/ && rm jetbrains-backend-plugin-1.0-SNAPSHOT.zip
17+
18+
FROM scratch
19+
ARG SUPERVISOR_IDE_CONFIG
20+
COPY --chown=33333:33333 ${SUPERVISOR_IDE_CONFIG} /ide-desktop/supervisor-ide-config.json
21+
COPY --chown=33333:33333 startup.sh /ide-desktop/
22+
COPY --chown=33333:33333 --from=build /app/status /ide-desktop/
23+
COPY --chown=33333:33333 --from=download /workdir/ /ide-desktop/backend/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash -li
2+
# Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -euo pipefail
7+
8+
# kill background jobs when the script exits
9+
trap "jobs -p | xargs -r kill" SIGINT SIGTERM EXIT
10+
11+
/ide-desktop/status 24000 "$1" &
12+
13+
export CWM_NON_INTERACTIVE=1
14+
export CWM_HOST_PASSWORD=gitpod
15+
export CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod
16+
/ide-desktop/backend/bin/remote-dev-server.sh cwmHost "$GITPOD_REPO_ROOT"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/gitpod-io/gitpod/jetbrains/status
2+
3+
go 1.17
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License-AGPL.txt in the project root for license information.
4+
5+
package main
6+
7+
import (
8+
"encoding/json"
9+
"fmt"
10+
"io/ioutil"
11+
"log"
12+
"net/http"
13+
"os"
14+
"time"
15+
)
16+
17+
// proxy for the Code With Me status endpoints that transforms it into the supervisor status format.
18+
func main() {
19+
if len(os.Args) < 2 {
20+
fmt.Printf("Usage: %s <port> [<link label>]\n", os.Args[0])
21+
os.Exit(1)
22+
}
23+
port := os.Args[1]
24+
label := "Open JetBrains IDE"
25+
if len(os.Args) > 2 {
26+
label = os.Args[2]
27+
}
28+
29+
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
30+
var (
31+
url = "http://localhost:63342/codeWithMe/unattendedHostStatus?token=gitpod"
32+
client = http.Client{Timeout: 1 * time.Second}
33+
)
34+
resp, err := client.Get(url)
35+
if err != nil {
36+
http.Error(w, err.Error(), http.StatusServiceUnavailable)
37+
return
38+
}
39+
defer resp.Body.Close()
40+
41+
bodyBytes, err := ioutil.ReadAll(resp.Body)
42+
if err != nil {
43+
http.Error(w, err.Error(), http.StatusServiceUnavailable)
44+
return
45+
}
46+
47+
if resp.StatusCode != http.StatusOK {
48+
// log.Printf("Desktop IDE status proxy: getting non-200 status - %d\n%s\n", resp.StatusCode, bodyBytes)
49+
http.Error(w, string(bodyBytes), resp.StatusCode)
50+
return
51+
}
52+
53+
type Projects struct {
54+
JoinLink string `json:"joinLink"`
55+
}
56+
type Response struct {
57+
Projects []Projects `json:"projects"`
58+
}
59+
jsonResp := &Response{}
60+
err = json.Unmarshal(bodyBytes, &jsonResp)
61+
62+
if err != nil {
63+
http.Error(w, "Error parsing JSON body from IDE status probe.", http.StatusServiceUnavailable)
64+
return
65+
}
66+
if len(jsonResp.Projects) != 1 {
67+
http.Error(w, "projects size != 1", http.StatusServiceUnavailable)
68+
return
69+
}
70+
response := make(map[string]string)
71+
response["link"] = jsonResp.Projects[0].JoinLink
72+
response["label"] = label
73+
w.Header().Set("Content-Type", "application/json")
74+
json.NewEncoder(w).Encode(response)
75+
})
76+
77+
fmt.Printf("Starting status proxy for desktop IDE at port %s\n", port)
78+
if err := http.ListenAndServe(fmt.Sprintf(":%s", port), nil); err != nil {
79+
log.Fatal(err)
80+
}
81+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"entrypoint": "/ide-desktop/startup.sh",
3+
"entrypointArgs": [ "Open GoLand IDE" ],
4+
"readinessProbe": {
5+
"type": "http",
6+
"http": {
7+
"port": 24000,
8+
"path": "/status"
9+
}
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"entrypoint": "/ide-desktop/startup.sh",
3+
"entrypointArgs": [ "Open IntelliJ IDEA IDE" ],
4+
"readinessProbe": {
5+
"type": "http",
6+
"http": {
7+
"port": 24000,
8+
"path": "/status"
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)