Skip to content

Commit bbf6d60

Browse files
committed
git-sync: removes special exit on first error
Old code used to exit at any error seen on first sync attempt. This didn't prove useful in practice, so removing that special case. This may make git-sync slower to recover after user fixes a non-retryable error, as now flMaxSyncFailures are needed before the pod fails. It may make sense in practice. Fixes #161, in a different way than is proposed in PR #162.
1 parent aa241c2 commit bbf6d60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/git-sync/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ func main() {
289289
if changed, err := syncRepo(ctx, *flRepo, *flBranch, *flRev, *flDepth, *flRoot, *flDest); err != nil {
290290
syncDuration.WithLabelValues("error").Observe(time.Now().Sub(start).Seconds())
291291
syncCount.WithLabelValues("error").Inc()
292-
if initialSync || (*flMaxSyncFailures != -1 && failCount >= *flMaxSyncFailures) {
292+
if *flMaxSyncFailures != -1 && failCount >= *flMaxSyncFailures {
293+
// Exit after too many retries, maybe the error is not recoverable.
293294
log.Error(err, "failed to sync repo, aborting")
294295
os.Exit(1)
295296
}

0 commit comments

Comments
 (0)