Skip to content

Commit

Permalink
fix(cli): resync repo list on workflow init (#4308)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and richardlt committed May 20, 2019
1 parent 8785b9b commit 2b0e10e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cli/cdsctl/workflow_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func interactiveChooseApplication(pkey, repoFullname, repoName string) (string,

func searchRepository(pkey, repoManagerName, repoFullname string) (string, error) {
var resync bool
for !resync {
for {
// Get repositories from the repository manager
repos, err := client.RepositoriesList(pkey, repoManagerName, resync)
if err != nil {
Expand All @@ -183,15 +183,17 @@ func searchRepository(pkey, repoManagerName, repoFullname string) (string, error
// Search the repo
for _, r := range repos {
// r.Fullname = CDS/demo
if strings.ToLower(r.Fullname) == repoFullname {
if strings.ToLower(r.Fullname) == strings.ToLower(repoFullname) {
fmt.Printf(" * using repository %s from %s", cli.Magenta(r.Fullname), cli.Magenta(repoManagerName))
fmt.Println()
return r.Fullname, nil
}
}
if resync {
break
}
resync = true
}

return "", fmt.Errorf("unable to find repository %s from %s: please check your credentials", repoFullname, repoManagerName)
}

Expand Down

0 comments on commit 2b0e10e

Please sign in to comment.