Skip to content

Fix supervisor panic when tkns and publicapi Service is nil #15274

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 3 commits into from
Dec 12, 2022

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Dec 9, 2022

Description

Review only commit e081051

Test also

package main

import (
	"fmt"
)

var t TestInterface
var t2 TestInterface

func main() {
	t = NewImplement()
	t.Echo("hello")

	t2 = NewImplement2()
	t2.Echo("hello")
}

type TestInterface interface {
	Echo(something string)
}

type Implement struct {
	hello *string
}

func NewImplement() *Implement {
	return nil
}

func NewImplement2() TestInterface {
	return nil
}

var _ TestInterface = (*Implement)(nil)

// Echo implements TestInterface
func (s *Implement) Echo(something string) {
	if s == nil {
		fmt.Println("s is nil")
		return
	}
	fmt.Println(*s.hello, something)
}

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-hw-supervisor.3 because the annotations in the pull request description changed
(with .werft/ from main)

@roboquat roboquat added the size/M label Dec 9, 2022
@mustard-mh mustard-mh force-pushed the hw/supervisor branch 2 times, most recently from 3830f6f to 10e0bcc Compare December 12, 2022 09:49
@roboquat roboquat added size/XXL and removed size/M labels Dec 12, 2022
@mustard-mh mustard-mh changed the title WIP: Supervisor Fix supervisor panic when tkns and publicapi Service is nil Dec 12, 2022
@mustard-mh mustard-mh marked this pull request as ready for review December 12, 2022 10:32
@mustard-mh mustard-mh requested review from a team December 12, 2022 10:32
@github-actions github-actions bot added team: IDE team: webapp Issue belongs to the WebApp team team: workspace Issue belongs to the Workspace team labels Dec 12, 2022
@mustard-mh
Copy link
Contributor Author

Tested

ImageBuild WorkspaceStart
SCR-20221212-pni SCR-20221212-pr9

@@ -32,10 +37,23 @@ type Attributes struct {
// If the environment contains CONFIGCAT_SDK_KEY value, it vill be used to construct a ConfigCat client.
// Otherwise, it returns a client which always returns the default value. This client is used for Self-Hosted installations.
func NewClient() Client {
gitpodHost := os.Getenv("GITPOD_HOST")
Copy link
Member

Choose a reason for hiding this comment

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

@mustard-mh it is a internal secret of supervisor which is a subject to change, why don't pass it as an argument?

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

approving to unblock, see comments for style/improvements

Comment on lines +42 to +58
return newConfigCatClient(configcat.Config{
SDKKey: "gitpod",
BaseURL: fmt.Sprintf("%s%s", gitpodHost, "/configcat"),
PollInterval: 1 * time.Minute,
HTTPTimeout: 3 * time.Second,
})
}
sdkKey := os.Getenv("CONFIGCAT_SDK_KEY")
if sdkKey == "" {
return NewAlwaysReturningDefaultValueClient()
}

return newConfigCatClient(sdkKey)
return newConfigCatClient(configcat.Config{
SDKKey: sdkKey,
PollInterval: 3 * time.Minute,
HTTPTimeout: 3 * time.Second,
Logger: &configCatLogger{log.Log},
})
Copy link
Member

Choose a reason for hiding this comment

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

there's duplication in the config that could be reduced.

@roboquat roboquat merged commit f0bf7b3 into main Dec 12, 2022
@roboquat roboquat deleted the hw/supervisor branch December 12, 2022 12:05
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed: IDE IDE change is running in production labels Dec 13, 2022
@roboquat roboquat added deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: IDE IDE change is running in production deployed: webapp Meta team change is running in production deployed: workspace Workspace team change is running in production deployed Change is completely running in production release-note-none size/XXL team: IDE team: webapp Issue belongs to the WebApp team team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants