Skip to content

Commit

Permalink
fix: populate cloud config without error on noLogin flag (#5697)
Browse files Browse the repository at this point in the history
  • Loading branch information
exu authored Jul 30, 2024
1 parent 435e213 commit 6fe2d82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions cmd/kubectl-testkube/commands/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,6 @@ func PopulateCloudConfig(cfg config.Data, apiKey string, opts *HelmOptions) conf
cfg.CloudContext.UiUri = opts.Master.URIs.Ui
cfg.CloudContext.AgentUri = opts.Master.URIs.Agent

if cfg.CloudContext.ApiKey != "" {
var err error
cfg, err = PopulateOrgAndEnvNames(cfg, opts.Master.OrgId, opts.Master.EnvId, opts.Master.URIs.Api)
if err != nil {
ui.Failf("Error populating org and env names: %s", err)
}
} else {
ui.Warn("No API key provided, you need to login to Testkube Cloud")
}

return cfg
}

Expand Down
10 changes: 10 additions & 0 deletions cmd/kubectl-testkube/commands/context/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ func NewSetContextCmd() *cobra.Command {

cfg = common.PopulateCloudConfig(cfg, apiKey, &opts)

if cfg.CloudContext.ApiKey != "" {
var err error
cfg, err = common.PopulateOrgAndEnvNames(cfg, opts.Master.OrgId, opts.Master.EnvId, opts.Master.URIs.Api)
if err != nil {
ui.Failf("Error populating org and env names: %s", err)
}
} else {
ui.Warn("No API key provided, you need to login to Testkube Cloud")
}

case config.ContextTypeKubeconfig:
// kubeconfig special use cases

Expand Down

0 comments on commit 6fe2d82

Please sign in to comment.