Skip to content

Commit 81338c2

Browse files
committed
Add user ID a query
Tool: gitpod/catfood.gitpod.cloud
1 parent 95e8259 commit 81338c2

File tree

5 files changed

+72
-6
lines changed

5 files changed

+72
-6
lines changed

.idea/gradle.xml

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ide/jetbrains/launcher/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func resolveToolboxLink(wsInfo *supervisor.WorkspaceInfoResponse) (string, error
415415
Scheme: "jetbrains",
416416
Host: "gateway",
417417
Path: "io.gitpod.toolbox.gateway/open-in-toolbox",
418-
RawQuery: fmt.Sprintf("host=%s&workspaceId=%s&debugWorkspace=%t", gitpodUrl.Hostname(), wsInfo.WorkspaceId, debugWorkspace),
418+
RawQuery: fmt.Sprintf("userId=%shost=%s&workspaceId=%s&debugWorkspace=%t", wsInfo.OwnerId, gitpodUrl.Hostname(), wsInfo.WorkspaceId, debugWorkspace),
419419
}
420420
return link.String(), nil
421421
}

components/ide/jetbrains/toolbox/README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@ Provides a way to connect to Gitpod Classic workspaces within the JetBrains Tool
66

77
- Start an environment on [Gitpod Flex](https://app.gitpod.io) with current repository
88
- Connect to the environment via **JetBrains Gateway** (because we want to restart Toolbox) SSH feature (user: gitpod_devcontainer)
9-
- [optional] Copy ./flex-sync.sh locally and chmod +x, the script is written for macOS, please adjust it if you're using other OS
10-
- Exec `./flex-sync.sh <env_host>`
9+
- [optional] Copy ./sync-flex.sh locally and chmod +x, the script is written for macOS, please adjust it if you're using other OS
10+
- Exec `./sync-flex.sh <env_host>`
11+
- Exec gradle task `./gradlew buildPluginFlex`, it will deploy plugin changes and restart Toolbox automatically.
12+
13+
## How to Develoop with Gitpod Classic
14+
15+
- [optional] Set your SSH Keys up https://catfood.gitpod.cloud/user/keys
16+
- Open a workspace on Gitpod Classic with current repository
17+
- Update default Java version to Java 21: `sdk install java 21.0.3.fx-zulu`
18+
- [optional] Connect to the environment via **JetBrains Gateway** (if you want to keep the editor opening when deploy Toolbox Plugin)
19+
- [optional] Copy ./sync-classic.sh locally and chmod +x, update the script base on your Gitpod host
20+
- Exec `./sync-classic.sh <workspace_id>`
21+
- Exec gradle task `./gradlew buildPluginFlex`, it will deploy plugin changes and restart Toolbox automatically.
1122

1223
## How to Develop locally
1324

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# shellcheck disable=all
3+
#
4+
# Sync the local Toolbox plugins folder from the build results of Gitpod Flex (`build/flex/*`) automatically
5+
# so that you could build with a remote environment
6+
7+
if [ $# -eq 0 ]; then
8+
echo "Usage: $0 <workspace_id>"
9+
echo "Example: $0 gitpodio-gitpod-5ndiqumln3b"
10+
exit 1
11+
fi
12+
13+
GITPOD_HOST="gitpod.io"
14+
WORKSPACE_ID="$1"
15+
REMOTE_HOST="$WORKSPACE_ID.ssh.ws.$GITPOD_HOST"
16+
PLUGIN_ID="io.gitpod.toolbox.gateway"
17+
LOCAL_DIR="$HOME/Library/Caches/JetBrains/Toolbox/plugins/$PLUGIN_ID"
18+
REMOTE_DIR="/workspace/gitpod/components/ide/jetbrains/toolbox/build/flex/$PLUGIN_ID"
19+
DEVCONTAINER_HOST="$WORKSPACE_ID@$REMOTE_HOST"
20+
21+
echo "Preparing..."
22+
23+
ssh $DEVCONTAINER_HOST "sudo apt-get update && sudo apt-get install -y rsync inotify-tools" > /dev/null
24+
25+
function sync_and_restart() {
26+
rsync -avz --delete "$DEVCONTAINER_HOST:$REMOTE_DIR/" "$LOCAL_DIR/"
27+
cat << 'EOF'
28+
===============================
29+
# access toolbox.log:
30+
echo debugClean > $HOME/Library/Logs/JetBrains/Toolbox/toolbox.log
31+
code $HOME/Library/Logs/JetBrains/Toolbox/toolbox.log
32+
33+
# restart Toolbox:
34+
pkill -f 'JetBrains Toolbox' || true && open /Applications/JetBrains\ Toolbox.app
35+
36+
EOF
37+
}
38+
39+
echo "Initing..."
40+
41+
sync_and_restart
42+
43+
echo "Watching for changes in $DEVCONTAINER_HOST:$REMOTE_DIR"
44+
45+
ssh $DEVCONTAINER_HOST "inotifywait -m -r -e modify,create,delete,move $REMOTE_DIR" | \
46+
while read path action file; do
47+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Change detected: $action $file"
48+
# Make sure remote is build
49+
sleep 3
50+
sync_and_restart
51+
done

components/ide/jetbrains/toolbox/flex-sync.sh components/ide/jetbrains/toolbox/sync-flex.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ if [ $# -eq 0 ]; then
1010
exit 1
1111
fi
1212

13+
PLUGIN_ID="io.gitpod.toolbox.gateway"
1314
REMOTE_HOST="$1"
14-
LOCAL_DIR="$HOME/Library/Caches/JetBrains/Toolbox/plugins"
15-
REMOTE_DIR="/workspace/gitpod/components/ide/jetbrains/toolbox/build/flex"
15+
LOCAL_DIR="$HOME/Library/Caches/JetBrains/Toolbox/plugins/$PLUGIN_ID"
16+
REMOTE_DIR="/workspace/gitpod/components/ide/jetbrains/toolbox/build/flex/$PLUGIN_ID"
1617
DEVCONTAINER_HOST="gitpod_devcontainer@$REMOTE_HOST"
1718

1819
echo "Preparing..."

0 commit comments

Comments
 (0)