Don't block on hooks when already synced + one-time
This commit is contained in:
parent
a497b98c76
commit
dec45c3caa
|
|
@ -566,38 +566,40 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
updateSyncMetrics(metricKeyNoOp, start)
|
updateSyncMetrics(metricKeyNoOp, start)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if initialSync {
|
if initialSync {
|
||||||
// Determine if git-sync should terminate for one of several reasons
|
// Determine if git-sync should terminate for one of several reasons
|
||||||
if *flOneTime {
|
if *flOneTime {
|
||||||
// Wait for hooks to complete at least once, if not nil, before
|
exitCode := 0 // is 0 if all hooks succeed, else is 1
|
||||||
// checking whether to stop program.
|
if changed {
|
||||||
// Assumes that if hook channels are not nil, they will have at
|
// Wait for hooks to complete at least once, if not nil, before
|
||||||
// least one value before getting closed
|
// checking whether to stop program.
|
||||||
exitCode := 0 // is 0 if all hooks succeed, else is 1
|
// Assumes that if hook channels are not nil, they will have at
|
||||||
if exechookRunner != nil {
|
// least one value before getting closed
|
||||||
if err := exechookRunner.WaitForCompletion(); err != nil {
|
if exechookRunner != nil {
|
||||||
exitCode = 1
|
if err := exechookRunner.WaitForCompletion(); err != nil {
|
||||||
|
exitCode = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if webhookRunner != nil {
|
||||||
|
if err := webhookRunner.WaitForCompletion(); err != nil {
|
||||||
|
exitCode = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
log.DeleteErrorFile()
|
||||||
|
os.Exit(exitCode)
|
||||||
}
|
}
|
||||||
if webhookRunner != nil {
|
if isHash, err := revIsHash(ctx, *flRev, *flRoot); err != nil {
|
||||||
if err := webhookRunner.WaitForCompletion(); err != nil {
|
log.Error(err, "can't tell if rev is a git hash, exiting", "rev", *flRev)
|
||||||
exitCode = 1
|
os.Exit(1)
|
||||||
}
|
} else if isHash {
|
||||||
|
log.V(0).Info("rev appears to be a git hash, no further sync needed", "rev", *flRev)
|
||||||
|
log.DeleteErrorFile()
|
||||||
|
sleepForever()
|
||||||
}
|
}
|
||||||
log.DeleteErrorFile()
|
initialSync = false
|
||||||
os.Exit(exitCode)
|
|
||||||
}
|
}
|
||||||
if isHash, err := revIsHash(ctx, *flRev, *flRoot); err != nil {
|
|
||||||
log.Error(err, "can't tell if rev is a git hash, exiting", "rev", *flRev)
|
|
||||||
os.Exit(1)
|
|
||||||
} else if isHash {
|
|
||||||
log.V(0).Info("rev appears to be a git hash, no further sync needed", "rev", *flRev)
|
|
||||||
log.DeleteErrorFile()
|
|
||||||
sleepForever()
|
|
||||||
}
|
|
||||||
initialSync = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if failCount > 0 {
|
if failCount > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue