--max-sync-failures -> --max-failures
Deprecate but retain the old flag and env.
This commit is contained in:
parent
12a1d1e298
commit
eb33e7cfcb
|
|
@ -221,7 +221,7 @@ OPTIONS
|
||||||
--man
|
--man
|
||||||
Print this manual and exit.
|
Print this manual and exit.
|
||||||
|
|
||||||
--max-sync-failures <int>, $GIT_SYNC_MAX_SYNC_FAILURES
|
--max-failures <int>, $GIT_SYNC_MAX_FAILURES
|
||||||
The number of consecutive failures allowed before aborting (the
|
The number of consecutive failures allowed before aborting (the
|
||||||
first sync must succeed), Setting this to -1 will retry forever
|
first sync must succeed), Setting this to -1 will retry forever
|
||||||
after the initial sync. (default: 0)
|
after the initial sync. (default: 0)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ var flSyncTimeout = pflag.Duration("sync-timeout", envDuration("GIT_SYNC_SYNC_TI
|
||||||
"the total time allowed for one complete sync, must be >= 10ms; --timeout overrides this")
|
"the total time allowed for one complete sync, must be >= 10ms; --timeout overrides this")
|
||||||
var flOneTime = pflag.Bool("one-time", envBool("GIT_SYNC_ONE_TIME", false),
|
var flOneTime = pflag.Bool("one-time", envBool("GIT_SYNC_ONE_TIME", false),
|
||||||
"exit after the first sync")
|
"exit after the first sync")
|
||||||
var flMaxSyncFailures = pflag.Int("max-sync-failures", envInt("GIT_SYNC_MAX_SYNC_FAILURES", 0),
|
var flMaxFailures = pflag.Int("max-failures", envInt("GIT_SYNC_MAX_FAILURES", 0),
|
||||||
"the number of consecutive failures allowed before aborting (the first sync must succeed, -1 will retry forever")
|
"the number of consecutive failures allowed before aborting (the first sync must succeed, -1 will retry forever")
|
||||||
var flChmod = pflag.Int("change-permissions", envInt("GIT_SYNC_PERMISSIONS", 0),
|
var flChmod = pflag.Int("change-permissions", envInt("GIT_SYNC_PERMISSIONS", 0),
|
||||||
"optionally change permissions on the checked-out files to the specified mode")
|
"optionally change permissions on the checked-out files to the specified mode")
|
||||||
|
|
@ -151,12 +151,15 @@ var flDest = pflag.String("dest", envString("GIT_SYNC_DEST", ""),
|
||||||
"DEPRECATED: use --link instead")
|
"DEPRECATED: use --link instead")
|
||||||
var flSyncHookCommand = pflag.String("sync-hook-command", envString("GIT_SYNC_HOOK_COMMAND", ""),
|
var flSyncHookCommand = pflag.String("sync-hook-command", envString("GIT_SYNC_HOOK_COMMAND", ""),
|
||||||
"DEPRECATED: use --exechook-command instead")
|
"DEPRECATED: use --exechook-command instead")
|
||||||
|
var flMaxSyncFailures = pflag.Int("max-sync-failures", envInt("GIT_SYNC_MAX_SYNC_FAILURES", 0),
|
||||||
|
"DEPRECATED: use --max-failures instead")
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pflag.CommandLine.MarkDeprecated("wait", "use --period instead")
|
pflag.CommandLine.MarkDeprecated("wait", "use --period instead")
|
||||||
pflag.CommandLine.MarkDeprecated("timeout", "use --sync-timeout instead")
|
pflag.CommandLine.MarkDeprecated("timeout", "use --sync-timeout instead")
|
||||||
pflag.CommandLine.MarkDeprecated("dest", "use --link instead")
|
pflag.CommandLine.MarkDeprecated("dest", "use --link instead")
|
||||||
pflag.CommandLine.MarkDeprecated("sync-hook-command", "use --exechook-command instead")
|
pflag.CommandLine.MarkDeprecated("sync-hook-command", "use --exechook-command instead")
|
||||||
|
pflag.CommandLine.MarkDeprecated("max-sync-failures", "use --max-failures instead")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total pull/error, summary on pull duration
|
// Total pull/error, summary on pull duration
|
||||||
|
|
@ -342,6 +345,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flDest != "" {
|
if *flDest != "" {
|
||||||
|
// Back-compat
|
||||||
*flLink = *flDest
|
*flLink = *flDest
|
||||||
}
|
}
|
||||||
if *flLink == "" {
|
if *flLink == "" {
|
||||||
|
|
@ -353,6 +357,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flWait != 0 {
|
if *flWait != 0 {
|
||||||
|
// Back-compat
|
||||||
*flPeriod = time.Duration(int(*flWait*1000)) * time.Millisecond
|
*flPeriod = time.Duration(int(*flWait*1000)) * time.Millisecond
|
||||||
}
|
}
|
||||||
if *flPeriod < 10*time.Millisecond {
|
if *flPeriod < 10*time.Millisecond {
|
||||||
|
|
@ -360,13 +365,20 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flTimeout != 0 {
|
if *flTimeout != 0 {
|
||||||
|
// Back-compat
|
||||||
*flSyncTimeout = time.Duration(*flTimeout) * time.Second
|
*flSyncTimeout = time.Duration(*flTimeout) * time.Second
|
||||||
}
|
}
|
||||||
if *flSyncTimeout < 10*time.Millisecond {
|
if *flSyncTimeout < 10*time.Millisecond {
|
||||||
handleConfigError(log, true, "ERROR: --sync-timeout must be at least 10ms")
|
handleConfigError(log, true, "ERROR: --sync-timeout must be at least 10ms")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *flMaxSyncFailures != 0 {
|
||||||
|
// Back-compat
|
||||||
|
*flMaxFailures = *flMaxSyncFailures
|
||||||
|
}
|
||||||
|
|
||||||
if *flSyncHookCommand != "" {
|
if *flSyncHookCommand != "" {
|
||||||
|
// Back-compat
|
||||||
*flExechookCommand = *flSyncHookCommand
|
*flExechookCommand = *flSyncHookCommand
|
||||||
}
|
}
|
||||||
if *flExechookCommand != "" {
|
if *flExechookCommand != "" {
|
||||||
|
|
@ -650,7 +662,7 @@ func main() {
|
||||||
if changed, hash, err := git.SyncRepo(ctx, refreshCreds); err != nil {
|
if changed, hash, err := git.SyncRepo(ctx, refreshCreds); err != nil {
|
||||||
failCount++
|
failCount++
|
||||||
updateSyncMetrics(metricKeyError, start)
|
updateSyncMetrics(metricKeyError, start)
|
||||||
if *flMaxSyncFailures != -1 && failCount > *flMaxSyncFailures {
|
if *flMaxFailures >= 0 && failCount > *flMaxFailures {
|
||||||
// Exit after too many retries, maybe the error is not recoverable.
|
// Exit after too many retries, maybe the error is not recoverable.
|
||||||
log.Error(err, "too many failures, aborting", "failCount", failCount)
|
log.Error(err, "too many failures, aborting", "failCount", failCount)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
@ -1840,10 +1852,10 @@ OPTIONS
|
||||||
--man
|
--man
|
||||||
Print this manual and exit.
|
Print this manual and exit.
|
||||||
|
|
||||||
--max-sync-failures <int>, $GIT_SYNC_MAX_SYNC_FAILURES
|
--max-failures <int>, $GIT_SYNC_MAX_FAILURES
|
||||||
The number of consecutive failures allowed before aborting (the
|
The number of consecutive failures allowed before aborting (the
|
||||||
first sync must succeed), Setting this to -1 will retry forever
|
first sync must succeed), Setting this to a negative value will
|
||||||
after the initial sync. (default: 0)
|
retry forever after the initial sync. (default: 0)
|
||||||
|
|
||||||
--one-time, $GIT_SYNC_ONE_TIME
|
--one-time, $GIT_SYNC_ONE_TIME
|
||||||
Exit after the first sync.
|
Exit after the first sync.
|
||||||
|
|
|
||||||
|
|
@ -1205,7 +1205,7 @@ function e2e::auth_askpass_url_flaky() {
|
||||||
GIT_SYNC \
|
GIT_SYNC \
|
||||||
--git="$ASKPASS_GIT" \
|
--git="$ASKPASS_GIT" \
|
||||||
--askpass-url="http://$IP/git_askpass" \
|
--askpass-url="http://$IP/git_askpass" \
|
||||||
--max-sync-failures=2 \
|
--max-failures=2 \
|
||||||
--period=100ms \
|
--period=100ms \
|
||||||
--repo="file://$REPO" \
|
--repo="file://$REPO" \
|
||||||
--branch="$MAIN_BRANCH" \
|
--branch="$MAIN_BRANCH" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue