@@ -21,7 +21,6 @@ import (
2121 "github.com/jenkins-x/jx/pkg/cmd/version"
2222
2323 jxcore "github.com/jenkins-x/jx-api/v4/pkg/apis/core/v4beta1"
24- "github.com/jenkins-x/jx-api/v4/pkg/client/clientset/versioned"
2524 "github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
2625 "github.com/rhysd/go-github-selfupdate/selfupdate"
2726
@@ -59,7 +58,6 @@ const (
5958type CLIOptions struct {
6059 CommandRunner cmdrunner.CommandRunner
6160 GitClient gitclient.Interface
62- JXClient versioned.Interface
6361 Version string
6462 VersionStreamGitURL string
6563 FromEnvironment bool
@@ -88,12 +86,7 @@ func NewCmdUpgradeCLI() (*cobra.Command, *CLIOptions) {
8886// Run implements the command
8987func (o * CLIOptions ) Run () error {
9088 var err error
91- o .JXClient , err = jxclient .LazyCreateJXClient (o .JXClient )
92- if err != nil {
93- return fmt .Errorf ("failed to create jx client: %w" , err )
94- }
9589
96- // upgrading to a specific version is not yet supported in brew so lets disable it for upgrades
9790 candidateInstallVersion , err := o .candidateInstallVersion ()
9891 if err != nil {
9992 return fmt .Errorf ("failed to find jx cli version: %w" , err )
@@ -179,7 +172,12 @@ func (o *CLIOptions) getVersionStreamURL(gitURL string) (string, error) {
179172 }
180173 if o .FromEnvironment {
181174 // lookup the cluster git repo from the dev environment and use that as the versionstream
182- env , err := jxenv .GetDevEnvironment (o .JXClient , jxcore .DefaultNamespace )
175+ jXClient , err := jxclient .LazyCreateJXClient (nil )
176+ if err != nil {
177+ return "" , fmt .Errorf ("failed to create jx client: %w" , err )
178+ }
179+
180+ env , err := jxenv .GetDevEnvironment (jXClient , jxcore .DefaultNamespace )
183181 if err == nil {
184182 if env .Spec .Source .URL != "" {
185183 gitURL = env .Spec .Source .URL
0 commit comments