Skip to content

Commit

Permalink
Fix fetch (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Foysal Iqbal authored Jun 2, 2020
1 parent 0aabf63 commit bcc321e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions pkg/qliksense/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package qliksense

import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -54,10 +53,7 @@ func (q *Qliksense) FetchK8sWithOpts(opts *FetchCommandOptions) error {
cr.SetFetchUrl(opts.GitUrl)
}
v := getVersion(opts, cr)
if v == "" {
return errors.New("Cannot find gitref/tag/branch/version to fetch")
}
if qConfig.IsRepoExistForCurrent(v) {
if v != "" && qConfig.IsRepoExistForCurrent(v) {
if opts.Overwrite || getVerionsOverwriteConfirmation(v) == "y" {
if err := qConfig.DeleteRepoForCurrent(v); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/qliksense/get_installable_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func getLatestTag(repoUrl, accessToken string) (string, error) {
v, err := semver.NewVersion(sv)
if err != nil {
// it may happen, in the repo some tags may not conform to semver
fmt.Print("Unconform tags: " + sv)
//fmt.Println("the tag is not conform to semver: " + sv)
continue
}
if maxSem == nil || maxSem.LessThan(v) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/qliksense/get_installable_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func TestGetLatestTag(t *testing.T) {
t.Log(err)
t.Log(sv)
}
baseV, _ := semver.NewVersion("v0.0.7")
baseV, _ := semver.NewVersion("v0.0.8")
if !sv.GreaterThan(baseV) {
t.Log("Expected greater than v0.0.7, but got: " + s)
t.Log("Expected greater than v0.0.8, but got: " + s)
t.Fail()
}
}

0 comments on commit bcc321e

Please sign in to comment.