Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

git: retry repo clone on status unreachable #3013

Merged
merged 1 commit into from
May 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions pkg/git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (r *Repo) step(bg context.Context) bool {
// process, so just exit.
return false

case RepoNew:
case RepoNew, RepoUnreachable:
rootdir, err := ioutil.TempDir(os.TempDir(), "flux-gitclone")
if err != nil {
panic(err)
Expand All @@ -323,12 +323,12 @@ func (r *Repo) step(bg context.Context) bool {
r.setUnready(RepoCloned, ErrClonedOnly)
return true
}
dir = ""
os.RemoveAll(rootdir)
if strings.Contains(strings.ToLower(err.Error()), "could not resolve hostname") {
r.setUnready(RepoUnreachable, err)
return false
}
dir = ""
os.RemoveAll(rootdir)
r.setUnready(RepoNew, err)
return false

Expand Down Expand Up @@ -373,9 +373,6 @@ func (r *Repo) step(bg context.Context) bool {
r.refreshed()
return true

case RepoUnreachable:
return false

case RepoReady:
return false
}
Expand Down