diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 7876f0a7b606..5185fae3623b 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -498,6 +498,8 @@ TIMEOUT = 60s ; Arguments for command 'git fsck', e.g. "--unreachable --tags" ; see more on http://git-scm.com/docs/git-fsck/1.7.5 ARGS = +; A list of repos which shouldn't be health-checked, e.g. "user1/repo1 user2/repo2" +SKIP_REPOS = ; Check repository statistics [cron.check_repo_stats] diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 93b4da9d32b9..91fc4f1d00db 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -258,6 +258,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `SCHEDULE`: **every 24h**: Cron syntax for scheduling repository health check. - `TIMEOUT`: **60s**: Time duration syntax for health check execution timeout. - `ARGS`: **\**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. +- `SKIP_REPOS`: **\**: A list of repos which shouldn't be health-checked, e.g. `user1/repo1 user2/repo2` ### Cron - Repository Statistics Check (`cron.check_repo_stats`) diff --git a/models/repo.go b/models/repo.go index ba5b7b36aff5..e9ec1c655069 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2171,6 +2171,14 @@ func GitFsck() { Iterate(new(Repository), func(idx int, bean interface{}) error { repo := bean.(*Repository) + repoFullName := repo.FullName() + for _, skipName := range setting.Cron.RepoHealthCheck.SkipRepos { + if repoFullName == skipName { + desc := fmt.Sprintf("Skipping health check for repository %s", repoFullName) + log.Trace(desc) + return nil + } + } repoPath := repo.RepoPath() if err := git.Fsck(repoPath, setting.Cron.RepoHealthCheck.Timeout, setting.Cron.RepoHealthCheck.Args...); err != nil { desc := fmt.Sprintf("Failed to health check repository (%s): %v", repoPath, err) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 9ef175d20eff..12ede8fad991 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -378,6 +378,7 @@ var ( Schedule string Timeout time.Duration Args []string `delim:" "` + SkipRepos []string `delim:" "` } `ini:"cron.repo_health_check"` CheckRepoStats struct { Enabled bool @@ -418,6 +419,7 @@ var ( Schedule string Timeout time.Duration Args []string `delim:" "` + SkipRepos []string `delim:" "` }{ Enabled: true, RunAtStart: false,