Skip to content

Commit

Permalink
Cleanup version (#1435)
Browse files Browse the repository at this point in the history
* Remove flux version check on version cmd

* update fake flux

Co-authored-by: Justin Thompson <jpthomp12@gmail.com>
  • Loading branch information
2 people authored and jpellizzari committed Mar 3, 2022
1 parent 901fb71 commit 43f13be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 99 deletions.
18 changes: 1 addition & 17 deletions cmd/gitops/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package version

import (
"fmt"

log "github.com/sirupsen/logrus"
"github.com/weaveworks/go-checkpoint"
"github.com/weaveworks/weave-gitops/pkg/flux"
"github.com/weaveworks/weave-gitops/pkg/osys"
"github.com/weaveworks/weave-gitops/pkg/runner"

"github.com/spf13/cobra"
)
Expand All @@ -31,14 +29,6 @@ func runCmd(cmd *cobra.Command, args []string) {
fmt.Println("GitCommit:", GitCommit)
fmt.Println("BuildTime:", BuildTime)
fmt.Println("Branch:", Branch)

version, err := CheckFluxVersion()
if err != nil {
fmt.Println(err)
return
}

fmt.Println("Flux Version:", version)
}

// CheckVersion looks to see if there is a newer version of the software available
Expand Down Expand Up @@ -75,9 +65,3 @@ func CheckpointParamsWithFlags(params *checkpoint.CheckParams, c *cobra.Command)

return p
}
func CheckFluxVersion() (string, error) {
cliRunner := &runner.CLIRunner{}
fluxClient := flux.New(osys.New(), cliRunner)

return fluxClient.GetVersion()
}
12 changes: 0 additions & 12 deletions pkg/flux/flux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Flux interface {
CreateHelmReleaseGitRepository(name, source, path, namespace, targetNamespace string) ([]byte, error)
CreateHelmReleaseHelmRepository(name, chart, namespace, targetNamespace string) ([]byte, error)
CreateSecretGit(name string, repoUrl gitproviders.RepoURL, namespace string) ([]byte, error)
GetVersion() (string, error)
GetAllResourcesStatus(name string, namespace string) ([]byte, error)
GetLatestStatusAllNamespaces() ([]string, error)
PreCheck() (string, error)
Expand Down Expand Up @@ -255,17 +254,6 @@ func (f *FluxClient) GetAllResourcesStatus(name string, namespace string) ([]byt
return out, nil
}

func (f *FluxClient) GetVersion() (string, error) {
out, err := f.runFluxCmd("-v")
if err != nil {
return "", err
}
// change string format to match our versioning standard
version := strings.ReplaceAll(string(out), "flux version ", "v")

return version, nil
}

func (f *FluxClient) runFluxCmd(args ...string) ([]byte, error) {
fluxPath, err := f.fluxPath()
if err != nil {
Expand Down
70 changes: 0 additions & 70 deletions pkg/flux/fluxfakes/fake_flux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43f13be

Please sign in to comment.