Skip to content

Commit 09c60f2

Browse files
committed
[rebuild] decoule IDE env vars from registry-facade
by moving in supervisor-ide-config.json
1 parent 2220a24 commit 09c60f2

File tree

50 files changed

+261
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+261
-59
lines changed

components/gitpod-cli/cmd/preview.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ func openPreview(gpBrowserEnvVar string, url string) error {
7575
}
7676

7777
var args []string
78-
if len(pargs) > 1 && pargs[1] != "" {
79-
args = append(args, pargs[1])
78+
for _, parg := range pargs[1:] {
79+
if parg == "" {
80+
continue
81+
}
82+
args = append(args, parg)
8083
}
8184
args = append(args, url)
8285

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Copyright (c) 2023 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 -Eeuo pipefail
7+
8+
DIR="$(dirname "$(realpath "$0")")"
9+
COMPONENT="$(basename "$DIR")"
10+
cd "$DIR"
11+
12+
# build
13+
go build .
14+
echo "$COMPONENT built"
15+
16+
sudo rm -rf "/ide/$COMPONENT" && true
17+
sudo mv ./"$COMPONENT" /ide
18+
sudo cp supervisor-ide-config.json /ide
19+
echo "$COMPONENT in /ide replaced"

components/ide/code/codehelper/supervisor-ide-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,14 @@
66
"http": {
77
"path": "version"
88
}
9+
},
10+
"env": {
11+
"PATH": "/ide/bin/remote-cli:$PATH",
12+
"EDITOR": "/ide/bin/remote-cli/gitpod-code",
13+
"VISUAL": "$EDITOR",
14+
"GP_OPEN_EDITOR": "$EDITOR",
15+
"GIT_EDITOR": "$EDITOR --wait",
16+
"GP_PREVIEW_BROWSER": "$EDITOR --preview",
17+
"GP_EXTERNAL_BROWSER": "$EDITOR --openExternal"
918
}
1019
}

components/ide/code/leeway.Dockerfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,6 @@ FROM scratch
9999
COPY --from=code_builder --chown=33333:33333 /vscode-web/ /ide/
100100
COPY --from=code_builder --chown=33333:33333 /vscode-reh-linux-x64/ /ide/
101101

102-
ENV GITPOD_ENV_APPEND_PATH=/ide/bin/remote-cli:
103-
104-
# editor config
105-
ENV GITPOD_ENV_SET_EDITOR=/ide/bin/remote-cli/gitpod-code
106-
ENV GITPOD_ENV_SET_VISUAL="$GITPOD_ENV_SET_EDITOR"
107-
ENV GITPOD_ENV_SET_GP_OPEN_EDITOR="$GITPOD_ENV_SET_EDITOR"
108-
ENV GITPOD_ENV_SET_GIT_EDITOR="$GITPOD_ENV_SET_EDITOR --wait"
109-
ENV GITPOD_ENV_SET_GP_PREVIEW_BROWSER="/ide/bin/remote-cli/gitpod-code --preview"
110-
ENV GITPOD_ENV_SET_GP_EXTERNAL_BROWSER="/ide/bin/remote-cli/gitpod-code --openExternal"
111-
112102
ARG CODE_VERSION
113103
ARG CODE_COMMIT
114104
LABEL "io.gitpod.ide.version"=$CODE_VERSION

components/ide/jetbrains/image/create-supervisor-config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ const ideConfigs = [
5252
path: "/status",
5353
},
5454
},
55+
env: {
56+
JETBRAINS_BACKEND_QUALIFIER: qualifier,
57+
PATH: `/ide-desktop/${name}/bin:$PATH`,
58+
EDITOR: `/ide-desktop/${name}/bin/idea-cli open`,
59+
VISUAL: "$EDITOR",
60+
GP_OPEN_EDITOR: "$EDITOR",
61+
GIT_EDITOR: "$EDITOR --wait",
62+
GP_PREVIEW_BROWSER: `/ide-desktop/${name}/bin/idea-cli preview`,
63+
GP_EXTERNAL_BROWSER: `/ide-desktop/${name}/bin/idea-cli preview`,
64+
},
5565
};
5666
fs.writeFileSync(`supervisor-ide-config_${name}.json`, JSON.stringify(template, null, 2), "utf-8");
5767
});

components/ide/jetbrains/image/leeway.Dockerfile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ ARG SUPERVISOR_IDE_CONFIG
1616
COPY --from=base_builder --chown=33333:33333 /ide-desktop/ /ide-desktop/
1717
COPY --chown=33333:33333 ${SUPERVISOR_IDE_CONFIG} /ide-desktop/supervisor-ide-config.json
1818
COPY --chown=33333:33333 components-ide-jetbrains-image--download-${JETBRAINS_DOWNLOAD_QUALIFIER}/backend /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/backend
19-
20-
ARG JETBRAINS_BACKEND_QUALIFIER
21-
ENV GITPOD_ENV_SET_JETBRAINS_BACKEND_QUALIFIER ${JETBRAINS_BACKEND_QUALIFIER}
22-
2319
COPY --chown=33333:33333 components-ide-jetbrains-cli--app/cli /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli
24-
ENV GITPOD_ENV_APPEND_PATH /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin:
25-
26-
# editor config
27-
ENV GITPOD_ENV_SET_EDITOR "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli open"
28-
ENV GITPOD_ENV_SET_VISUAL "$GITPOD_ENV_SET_EDITOR"
29-
ENV GITPOD_ENV_SET_GP_OPEN_EDITOR "$GITPOD_ENV_SET_EDITOR"
30-
ENV GITPOD_ENV_SET_GIT_EDITOR "$GITPOD_ENV_SET_EDITOR --wait"
31-
ENV GITPOD_ENV_SET_GP_PREVIEW_BROWSER "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli preview"
32-
ENV GITPOD_ENV_SET_GP_EXTERNAL_BROWSER "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli preview"
3320

3421
LABEL "io.gitpod.ide.version"=$JETBRAINS_BACKEND_VERSION

components/ide/jetbrains/image/supervisor-ide-config_clion-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/clion-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/clion-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/clion-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/clion-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_clion.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/clion/bin:$PATH",
17+
"EDITOR": "/ide-desktop/clion/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/clion/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/clion/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_goland-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/goland-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/goland-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/goland-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/goland-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_goland.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/goland/bin:$PATH",
17+
"EDITOR": "/ide-desktop/goland/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/goland/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/goland/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_intellij-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/intellij-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/intellij-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/intellij-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/intellij-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_intellij.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/intellij/bin:$PATH",
17+
"EDITOR": "/ide-desktop/intellij/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/intellij/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/intellij/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_phpstorm-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/phpstorm-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/phpstorm-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/phpstorm-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/phpstorm-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_phpstorm.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/phpstorm/bin:$PATH",
17+
"EDITOR": "/ide-desktop/phpstorm/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/phpstorm/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/phpstorm/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_pycharm-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/pycharm-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/pycharm-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/pycharm-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/pycharm-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_pycharm.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/pycharm/bin:$PATH",
17+
"EDITOR": "/ide-desktop/pycharm/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/pycharm/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/pycharm/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_rider-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/rider-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/rider-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/rider-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/rider-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_rider.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/rider/bin:$PATH",
17+
"EDITOR": "/ide-desktop/rider/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/rider/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/rider/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_rubymine-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/rubymine-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/rubymine-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/rubymine-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/rubymine-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_rubymine.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/rubymine/bin:$PATH",
17+
"EDITOR": "/ide-desktop/rubymine/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/rubymine/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/rubymine/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_webstorm-latest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "latest",
16+
"PATH": "/ide-desktop/webstorm-latest/bin:$PATH",
17+
"EDITOR": "/ide-desktop/webstorm-latest/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/webstorm-latest/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/webstorm-latest/bin/idea-cli preview"
1323
}
1424
}

components/ide/jetbrains/image/supervisor-ide-config_webstorm.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,15 @@
1010
"http": {
1111
"path": "/status"
1212
}
13+
},
14+
"env": {
15+
"JETBRAINS_BACKEND_QUALIFIER": "stable",
16+
"PATH": "/ide-desktop/webstorm/bin:$PATH",
17+
"EDITOR": "/ide-desktop/webstorm/bin/idea-cli open",
18+
"VISUAL": "$EDITOR",
19+
"GP_OPEN_EDITOR": "$EDITOR",
20+
"GIT_EDITOR": "$EDITOR --wait",
21+
"GP_PREVIEW_BROWSER": "/ide-desktop/webstorm/bin/idea-cli preview",
22+
"GP_EXTERNAL_BROWSER": "/ide-desktop/webstorm/bin/idea-cli preview"
1323
}
1424
}

components/supervisor/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ require (
9090
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
9191
github.com/hashicorp/golang-lru v0.5.1 // indirect
9292
github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb // indirect
93+
github.com/iancoleman/orderedmap v0.2.0
9394
github.com/inconshreveable/mousetrap v1.0.0 // indirect
9495
github.com/jmespath/go-jmespath v0.4.0 // indirect
9596
github.com/json-iterator/go v1.1.12 // indirect

components/supervisor/go.sum

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/supervisor/pkg/supervisor/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
csapi "github.com/gitpod-io/gitpod/content-service/api"
2222
gitpod "github.com/gitpod-io/gitpod/gitpod-protocol"
2323
"github.com/gitpod-io/gitpod/supervisor/api"
24+
25+
"github.com/iancoleman/orderedmap"
2426
)
2527

2628
const supervisorConfigFile = "supervisor-config.json"
@@ -154,6 +156,10 @@ type IDEConfig struct {
154156
Path string `json:"path"`
155157
} `json:"http"`
156158
} `json:"readinessProbe"`
159+
160+
// A set of name-value pairs that sets or overrides environment variables for the workspace.
161+
// Environment may be referenced in the values.
162+
Env *orderedmap.OrderedMap
157163
}
158164

159165
// Validate validates this configuration.

0 commit comments

Comments
 (0)