let the contrib/git-sync use a for-loop, rather than relying on the pod's restart policy, to periodically pull from the repo

This commit is contained in:
Chao Xu 2015-06-01 11:13:37 -07:00
parent 94c6c121cc
commit 1f8404cb6a

View File

@ -66,6 +66,7 @@ func main() {
if _, err := exec.LookPath("git"); err != nil {
log.Fatalf("required git executable not found: %v", err)
}
for {
if err := syncRepo(*flRepo, *flDest, *flBranch, *flRev); err != nil {
log.Fatalf("error syncing repo: %v", err)
}
@ -73,6 +74,7 @@ func main() {
time.Sleep(time.Duration(*flWait) * time.Second)
log.Println("done")
}
}
// syncRepo syncs the branch of a given repository to the destination at the given rev.
func syncRepo(repo, dest, branch, rev string) error {