Skip to content

Commit eaee8ec

Browse files
author
Andrea Falzetti
committed
update
1 parent 41e2895 commit eaee8ec

File tree

1 file changed

+7
-57
lines changed

1 file changed

+7
-57
lines changed

components/ide-service/pkg/server/server.go

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,6 @@ type WorkspaceContext struct {
188188
ReferrerIde string `json:"referrerIde,omitempty"`
189189
}
190190

191-
var JetbrainsCode map[string]string
192-
193-
func init() {
194-
JetbrainsCode = make(map[string]string)
195-
JetbrainsCode["intellij"] = "IIU"
196-
JetbrainsCode["goland"] = "GO"
197-
JetbrainsCode["pycharm"] = "PCP"
198-
JetbrainsCode["phpstorm"] = "PS"
199-
JetbrainsCode["rubymine"] = "RM"
200-
JetbrainsCode["webstorm"] = "WS"
201-
JetbrainsCode["rider"] = "RD"
202-
JetbrainsCode["clion"] = "CL"
203-
}
204-
205191
func (s *IDEServiceServer) resolveReferrerIDE(ideConfig *config.IDEConfig, wsCtx *WorkspaceContext, chosenIDEName string) (ideName string, ideOption *config.IDEOption) {
206192
if wsCtx == nil || wsCtx.Referrer == "" {
207193
return
@@ -365,55 +351,19 @@ func (s *IDEServiceServer) ResolveWorkspaceConfig(ctx context.Context, req *api.
365351
if prebuilds.Version != "latest" {
366352
template := `
367353
echo 'warming up stable release of ${key}...'
368-
echo 'downloading stable ${key} backend...'
369-
mkdir /tmp/backend
370-
curl -sSLo /tmp/backend/backend.tar.gz "https://download.jetbrains.com/product?type=release&distribution=linux&code=${productCode}"
371-
tar -xf /tmp/backend/backend.tar.gz --strip-components=1 --directory /tmp/backend
372-
373-
echo 'configuring JB system config and caches aligned with runtime...'
374-
printf '\nshared.indexes.download.auto.consent=true' >> "/tmp/backend/bin/idea.properties"
375-
unset JAVA_TOOL_OPTIONS
376-
export IJ_HOST_CONFIG_BASE_DIR=/workspace/.config/JetBrains
377-
export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains
378-
379-
echo 'running stable ${key} backend in warmup mode...'
380-
/tmp/backend/bin/remote-dev-server.sh warmup "$GITPOD_REPO_ROOT"
381-
382-
echo 'removing stable ${key} backend...'
383-
rm -rf /tmp/backend
354+
JETBRAINS_BACKEND_QUALIFIER=stable /ide-desktop/${key}/status warmup ${key}
384355
`
385-
if code, ok := JetbrainsCode[alias]; ok {
386-
template = strings.ReplaceAll(template, "${key}", alias)
387-
template = strings.ReplaceAll(template, "${productCode}", code)
388-
warmUpTask += template
389-
}
356+
template = strings.ReplaceAll(template, "${key}", alias)
357+
warmUpTask += template
390358
}
391359

392360
if prebuilds.Version != "stable" {
393361
template := `
394-
echo 'warming up latest release of ${key}...'
395-
echo 'downloading latest ${key} backend...'
396-
mkdir /tmp/backend-latest
397-
curl -sSLo /tmp/backend-latest/backend-latest.tar.gz "https://download.jetbrains.com/product?type=release,eap,rc&distribution=linux&code=${productCode}"
398-
tar -xf /tmp/backend-latest/backend-latest.tar.gz --strip-components=1 --directory /tmp/backend-latest
399-
400-
echo 'configuring JB system config and caches aligned with runtime...'
401-
printf '\nshared.indexes.download.auto.consent=true' >> "/tmp/backend-latest/bin/idea.properties"
402-
unset JAVA_TOOL_OPTIONS
403-
export IJ_HOST_CONFIG_BASE_DIR=/workspace/.config/JetBrains-latest
404-
export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains-latest
405-
406-
echo 'running ${key} backend in warmup mode...'
407-
/tmp/backend-latest/bin/remote-dev-server.sh warmup "$GITPOD_REPO_ROOT"
408-
409-
echo 'removing latest ${key} backend...'
410-
rm -rf /tmp/backend-latest
362+
echo 'warming up stable release of ${key}...'
363+
JETBRAINS_BACKEND_QUALIFIER=latest /ide-desktop/${key}-latest/status warmup ${key}
411364
`
412-
if code, ok := JetbrainsCode[alias]; ok {
413-
template = strings.ReplaceAll(template, "${key}", alias)
414-
template = strings.ReplaceAll(template, "${productCode}", code)
415-
warmUpTask += template
416-
}
365+
template = strings.ReplaceAll(template, "${key}", alias)
366+
warmUpTask += template
417367
}
418368
}
419369
}

0 commit comments

Comments
 (0)