Skip to content
Closed
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
2 changes: 1 addition & 1 deletion components/ide/gha-update-image/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ scripts:
cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)
for ide in "${ide_list[@]}"; do
for prop in "${prop_list[@]}"; do
cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"eu.gcr.io/gitpod-dev-artifact/build/ide/$ide:latest\"")
cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"public.ecr.aws/b4b1c2l9/application/ide/intellij:latest\"")
done
done
cf_patch=$(echo "$cf_patch" |jq tostring)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pluginUntilBuild=243.*
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions=2024.3
# Version from "com.jetbrains.intellij.idea" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
platformVersion=243.15521.24
platformVersion=243.20847.40
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object ControllerStatusService {
retry(3) {
val port = BuiltInServerManager.getInstance().waitForStart().port
val httpRequest = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:$port/codeWithMe/unattendedHostStatus?token=$cwmToken"))
.uri(URI.create("http://127.0.0.1:$port/codeWithMe/unattendedHostStatus?token=$cwmToken"))
.header("Content-Type", "application/json")
.GET()
.build()
Expand Down
13 changes: 9 additions & 4 deletions components/ide/jetbrains/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func serve(launchCtx *LaunchContext) {
}
fmt.Fprint(w, jsonLink)
})
var lastErr error
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
if launchCtx.preferToolbox {
response := make(map[string]string)
Expand All @@ -319,6 +320,10 @@ func serve(launchCtx *LaunchContext) {
backendPort = defaultBackendPort
}
if err := isBackendPluginReady(r.Context(), backendPort, launchCtx.shouldWaitBackendPlugin); err != nil {
if lastErr == nil || err.Error() != lastErr.Error() {
log.WithError(err).Error("failed to check if backend plugin is ready")
lastErr = err
}
http.Error(w, err.Error(), http.StatusServiceUnavailable)
return
}
Expand Down Expand Up @@ -351,7 +356,7 @@ func isBackendPluginReady(ctx context.Context, backendPort string, shouldWaitBac
}
log.WithField("backendPort", backendPort).Debug("wait backend plugin to be ready")
// Use op=metrics so that we don't need to rebuild old backend-plugin
url, err := url.Parse("http://localhost:" + backendPort + "/api/gitpod/cli?op=metrics")
url, err := url.Parse("http://127.0.0.1:" + backendPort + "/api/gitpod/cli?op=metrics")
if err != nil {
return err
}
Expand Down Expand Up @@ -432,7 +437,7 @@ func resolveGatewayLink(backendPort string, wsInfo *supervisor.WorkspaceInfoResp

func resolveJsonLink(backendPort string) (string, error) {
var (
hostStatusUrl = "http://localhost:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod"
hostStatusUrl = "http://127.0.0.1:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod"
client = http.Client{Timeout: 1 * time.Second}
)
resp, err := client.Get(hostStatusUrl)
Expand Down Expand Up @@ -460,7 +465,7 @@ func resolveJsonLink(backendPort string) (string, error) {

func resolveJsonLink2(launchCtx *LaunchContext, backendPort string) (*JoinLinkResponse, error) {
var (
hostStatusUrl = "http://localhost:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod"
hostStatusUrl = "http://127.0.0.1:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod"
client = http.Client{Timeout: 1 * time.Second}
)
resp, err := client.Get(hostStatusUrl)
Expand Down Expand Up @@ -492,7 +497,7 @@ func resolveJsonLink2(launchCtx *LaunchContext, backendPort string) (*JoinLinkRe

func terminateIDE(backendPort string) error {
var (
hostStatusUrl = "http://localhost:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod&exit=true"
hostStatusUrl = "http://127.0.0.1:" + backendPort + "/codeWithMe/unattendedHostStatus?token=gitpod&exit=true"
client = http.Client{Timeout: 10 * time.Second}
)
resp, err := client.Get(hostStatusUrl)
Expand Down
1 change: 1 addition & 0 deletions components/ide/jetbrains/launcher/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestParseGitpodConfig(t *testing.T) {
}

func TestUpdateVMOptions(t *testing.T) {
t.Skip("hot-dpeloy")
tests := []struct {
Desc string
Alias string
Expand Down
48 changes: 39 additions & 9 deletions components/supervisor/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/gitpod-io/gitpod/common-go/process"
"github.com/gitpod-io/gitpod/supervisor/pkg/shared"
"github.com/gitpod-io/gitpod/supervisor/pkg/supervisor"
reaper "github.com/gitpod-io/go-reaper"
"github.com/prometheus/procfs"
reaper "github.com/ramr/go-reaper"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -77,25 +77,55 @@ var initCmd = &cobra.Command{
}

supervisorDone := make(chan struct{})
handledByReaper := make(chan int)
handleSupervisorExit := func(exitCode int) {
if exitCode == 0 {
return
}
logs := extractFailureFromRun()
if shared.IsExpectedShutdown(exitCode) {
log.Fatal(logs)
} else {
log.WithError(fmt.Errorf(logs)).Fatal("supervisor run error with unexpected exit code")
}
}
go func() {
defer close(supervisorDone)

err := runCommand.Wait()
if err != nil && !(strings.Contains(err.Error(), "signal: ") || strings.Contains(err.Error(), "no child processes")) {
if err == nil {
return
}
// exited by reaper
if strings.Contains(err.Error(), "no child processes") {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
select {
case <-ctx.Done(): // timeout
case exitCode := <-handledByReaper:
handleSupervisorExit(exitCode)
}
} else if !(strings.Contains(err.Error(), "signal: ")) {
if eerr, ok := err.(*exec.ExitError); ok && eerr.ExitCode() != 0 {
logs := extractFailureFromRun()
if shared.IsExpectedShutdown(eerr.ExitCode()) {
log.Fatal(logs)
} else {
log.WithError(fmt.Errorf(logs)).Fatal("supervisor run error with unexpected exit code")
}
handleSupervisorExit(eerr.ExitCode())
}
log.WithError(err).Error("supervisor run error")
return
}
}()
// start the reaper to clean up zombie processes
reaper.Reap()
reaper.Start(reaper.Config{
Pid: -1,
Options: 0,
DisablePid1Check: false,
OnReap: func(pid int, wstatus syscall.WaitStatus) {
if pid != runCommand.Process.Pid {
return
}
exitCode := wstatus.ExitStatus()
handledByReaper <- exitCode
},
})

select {
case <-supervisorDone:
Expand Down
2 changes: 1 addition & 1 deletion components/supervisor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/gitpod-io/gitpod/ide-metrics-api v0.0.0-00010101000000-000000000000
github.com/gitpod-io/gitpod/supervisor/api v0.0.0-00010101000000-000000000000
github.com/gitpod-io/gitpod/ws-daemon/api v0.0.0-00010101000000-000000000000
github.com/gitpod-io/go-reaper v0.0.0-20241023132555-bf7fe3193e95
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
Expand All @@ -29,7 +30,6 @@ require (
github.com/prometheus/common v0.42.0
github.com/prometheus/procfs v0.10.1
github.com/prometheus/pushgateway v1.5.1
github.com/ramr/go-reaper v0.2.1
github.com/sirupsen/logrus v1.9.3
github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.4.0
Expand Down
4 changes: 2 additions & 2 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 @@ -393,6 +393,12 @@ func (c WorkspaceConfig) Validate() error {
}

func (c Config) GetDesktopIDE() *IDEConfig {
testAA := func() bool {
return true
}
if testAA() {
return nil
}
if len(c.DesktopIDEs) == 0 {
return nil
}
Expand Down
Loading