Skip to content

[rebuild] decouple IDE env vars from registry-facade #16812

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

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions components/gitpod-cli/cmd/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ func openPreview(gpBrowserEnvVar string, url string) error {
}

var args []string
if len(pargs) > 1 && pargs[1] != "" {
args = append(args, pargs[1])
for _, parg := range pargs[1:] {
if parg == "" {
continue
}
args = append(args, parg)
}
args = append(args, url)

Expand Down
19 changes: 19 additions & 0 deletions components/ide/code/codehelper/rebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright (c) 2023 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 -Eeuo pipefail

DIR="$(dirname "$(realpath "$0")")"
COMPONENT="$(basename "$DIR")"
cd "$DIR"

# build
go build .
echo "$COMPONENT built"

sudo rm -rf "/ide/$COMPONENT" && true
sudo mv ./"$COMPONENT" /ide
sudo cp supervisor-ide-config.json /ide
echo "$COMPONENT in /ide replaced"
9 changes: 9 additions & 0 deletions components/ide/code/codehelper/supervisor-ide-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@
"http": {
"path": "version"
}
},
"env": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filiptronicek you will need to adjust Xterm example after deployment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up!

"PATH": "/ide/bin/remote-cli:$PATH",
"EDITOR": "/ide/bin/remote-cli/gitpod-code",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "$EDITOR --preview",
"GP_EXTERNAL_BROWSER": "$EDITOR --openExternal"
}
}
10 changes: 0 additions & 10 deletions components/ide/code/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ FROM scratch
COPY --from=code_builder --chown=33333:33333 /vscode-web/ /ide/
COPY --from=code_builder --chown=33333:33333 /vscode-reh-linux-x64/ /ide/

ENV GITPOD_ENV_APPEND_PATH=/ide/bin/remote-cli:

# editor config
ENV GITPOD_ENV_SET_EDITOR=/ide/bin/remote-cli/gitpod-code
ENV GITPOD_ENV_SET_VISUAL="$GITPOD_ENV_SET_EDITOR"
ENV GITPOD_ENV_SET_GP_OPEN_EDITOR="$GITPOD_ENV_SET_EDITOR"
ENV GITPOD_ENV_SET_GIT_EDITOR="$GITPOD_ENV_SET_EDITOR --wait"
ENV GITPOD_ENV_SET_GP_PREVIEW_BROWSER="/ide/bin/remote-cli/gitpod-code --preview"
ENV GITPOD_ENV_SET_GP_EXTERNAL_BROWSER="/ide/bin/remote-cli/gitpod-code --openExternal"

ARG CODE_VERSION
ARG CODE_COMMIT
LABEL "io.gitpod.ide.version"=$CODE_VERSION
Expand Down
10 changes: 10 additions & 0 deletions components/ide/jetbrains/image/create-supervisor-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ const ideConfigs = [
path: "/status",
},
},
env: {
JETBRAINS_BACKEND_QUALIFIER: qualifier,
PATH: `/ide-desktop/${name}/bin:$PATH`,
EDITOR: `/ide-desktop/${name}/bin/idea-cli open`,
VISUAL: "$EDITOR",
GP_OPEN_EDITOR: "$EDITOR",
GIT_EDITOR: "$EDITOR --wait",
GP_PREVIEW_BROWSER: `/ide-desktop/${name}/bin/idea-cli preview`,
GP_EXTERNAL_BROWSER: `/ide-desktop/${name}/bin/idea-cli preview`,
},
};
fs.writeFileSync(`supervisor-ide-config_${name}.json`, JSON.stringify(template, null, 2), "utf-8");
});
Expand Down
13 changes: 0 additions & 13 deletions components/ide/jetbrains/image/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ ARG SUPERVISOR_IDE_CONFIG
COPY --from=base_builder --chown=33333:33333 /ide-desktop/ /ide-desktop/
COPY --chown=33333:33333 ${SUPERVISOR_IDE_CONFIG} /ide-desktop/supervisor-ide-config.json
COPY --chown=33333:33333 components-ide-jetbrains-image--download-${JETBRAINS_DOWNLOAD_QUALIFIER}/backend /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/backend

ARG JETBRAINS_BACKEND_QUALIFIER
ENV GITPOD_ENV_SET_JETBRAINS_BACKEND_QUALIFIER ${JETBRAINS_BACKEND_QUALIFIER}

COPY --chown=33333:33333 components-ide-jetbrains-cli--app/cli /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli
ENV GITPOD_ENV_APPEND_PATH /ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin:

# editor config
ENV GITPOD_ENV_SET_EDITOR "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli open"
ENV GITPOD_ENV_SET_VISUAL "$GITPOD_ENV_SET_EDITOR"
ENV GITPOD_ENV_SET_GP_OPEN_EDITOR "$GITPOD_ENV_SET_EDITOR"
ENV GITPOD_ENV_SET_GIT_EDITOR "$GITPOD_ENV_SET_EDITOR --wait"
ENV GITPOD_ENV_SET_GP_PREVIEW_BROWSER "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli preview"
ENV GITPOD_ENV_SET_GP_EXTERNAL_BROWSER "/ide-desktop/${JETBRAINS_DOWNLOAD_QUALIFIER}/bin/idea-cli preview"

LABEL "io.gitpod.ide.version"=$JETBRAINS_BACKEND_VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/clion-latest/bin:$PATH",
"EDITOR": "/ide-desktop/clion-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/clion-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/clion-latest/bin/idea-cli preview"
}
}
10 changes: 10 additions & 0 deletions components/ide/jetbrains/image/supervisor-ide-config_clion.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/clion/bin:$PATH",
"EDITOR": "/ide-desktop/clion/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/clion/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/clion/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/goland-latest/bin:$PATH",
"EDITOR": "/ide-desktop/goland-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/goland-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/goland-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/goland/bin:$PATH",
"EDITOR": "/ide-desktop/goland/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/goland/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/goland/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/intellij-latest/bin:$PATH",
"EDITOR": "/ide-desktop/intellij-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/intellij-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/intellij-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/intellij/bin:$PATH",
"EDITOR": "/ide-desktop/intellij/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/intellij/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/intellij/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/phpstorm-latest/bin:$PATH",
"EDITOR": "/ide-desktop/phpstorm-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/phpstorm-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/phpstorm-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/phpstorm/bin:$PATH",
"EDITOR": "/ide-desktop/phpstorm/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/phpstorm/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/phpstorm/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/pycharm-latest/bin:$PATH",
"EDITOR": "/ide-desktop/pycharm-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/pycharm-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/pycharm-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/pycharm/bin:$PATH",
"EDITOR": "/ide-desktop/pycharm/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/pycharm/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/pycharm/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/rider-latest/bin:$PATH",
"EDITOR": "/ide-desktop/rider-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/rider-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/rider-latest/bin/idea-cli preview"
}
}
10 changes: 10 additions & 0 deletions components/ide/jetbrains/image/supervisor-ide-config_rider.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/rider/bin:$PATH",
"EDITOR": "/ide-desktop/rider/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/rider/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/rider/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/rubymine-latest/bin:$PATH",
"EDITOR": "/ide-desktop/rubymine-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/rubymine-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/rubymine-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/rubymine/bin:$PATH",
"EDITOR": "/ide-desktop/rubymine/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/rubymine/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/rubymine/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "latest",
"PATH": "/ide-desktop/webstorm-latest/bin:$PATH",
"EDITOR": "/ide-desktop/webstorm-latest/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/webstorm-latest/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/webstorm-latest/bin/idea-cli preview"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@
"http": {
"path": "/status"
}
},
"env": {
"JETBRAINS_BACKEND_QUALIFIER": "stable",
"PATH": "/ide-desktop/webstorm/bin:$PATH",
"EDITOR": "/ide-desktop/webstorm/bin/idea-cli open",
"VISUAL": "$EDITOR",
"GP_OPEN_EDITOR": "$EDITOR",
"GIT_EDITOR": "$EDITOR --wait",
"GP_PREVIEW_BROWSER": "/ide-desktop/webstorm/bin/idea-cli preview",
"GP_EXTERNAL_BROWSER": "/ide-desktop/webstorm/bin/idea-cli preview"
}
}
1 change: 1 addition & 0 deletions components/supervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ require (
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb // indirect
github.com/iancoleman/orderedmap v0.2.0
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
2 changes: 2 additions & 0 deletions components/supervisor/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions components/supervisor/pkg/supervisor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
csapi "github.com/gitpod-io/gitpod/content-service/api"
gitpod "github.com/gitpod-io/gitpod/gitpod-protocol"
"github.com/gitpod-io/gitpod/supervisor/api"

"github.com/iancoleman/orderedmap"
)

const supervisorConfigFile = "supervisor-config.json"
Expand Down Expand Up @@ -154,6 +156,10 @@ type IDEConfig struct {
Path string `json:"path"`
} `json:"http"`
} `json:"readinessProbe"`

// A set of name-value pairs that sets or overrides environment variables for the workspace.
// Environment may be referenced in the values.
Env *orderedmap.OrderedMap
}

// Validate validates this configuration.
Expand Down
Loading