Skip to content
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

fix: kurtosis web cmd work for remote context #1486

Merged
merged 1 commit into from Oct 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions cli/cli/commands/web/web.go
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/contexts-config-store/store"
"github.com/kurtosis-tech/stacktrace"
)

Expand All @@ -22,11 +24,23 @@ var WebCmd = &lowlevel.LowlevelKurtosisCommand{
}

const (
webUiLink = "http://localhost:9711/enclaves"
webUILink = "http://localhost:9711/enclaves"
)

func run(_ context.Context, _ *flags.ParsedFlags, _ *args.ParsedArgs) error {
if err := multi_os_command_executor.OpenFile(webUiLink); err != nil {

contextsConfigStore := store.GetContextsConfigStore()
currentKurtosisContext, err := contextsConfigStore.GetCurrentContext()
if err != nil {
return stacktrace.Propagate(err, "tried fetching the current Kurtosis context but failed, we can't switch clusters without this information. This is a bug in Kurtosis")
}
if store.IsRemote(currentKurtosisContext) {
if err := multi_os_command_executor.OpenFile(user_support_constants.KurtosisCloudLink); err != nil {
return stacktrace.Propagate(err, "An error occurred while opening the Kurtosis Cloud Web UI")
}
}

if err := multi_os_command_executor.OpenFile(webUILink); err != nil {
return stacktrace.Propagate(err, "An error occurred while opening the Kurtosis Web UI")
}
return nil
Expand Down
2 changes: 2 additions & 0 deletions cli/cli/user_support_constants/user_support_constants.go
Expand Up @@ -30,6 +30,7 @@ const (
FeedbackEmail = "feedback@" + OldDomain
FeedbackEmailLink = "mailto:" + FeedbackEmail
KurtosisTechTwitterProfileLink = "https://twitter.com/KurtosisTech"
KurtosisCloudLink = "https://cloud." + Domain

// If you add new URLs above, make sure to add them to the urlsToValidateInTest below!!!
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Expand All @@ -55,4 +56,5 @@ var urlsToValidateInTest = []string{
KurtosisOnBoardCalendlyUrl,
HowImportWorksLink,
KurtosisTechTwitterProfileLink,
KurtosisCloudLink,
}