Commit ea787165 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Move 'clear checks' button to applicatoin settings

parent 97f4ffff
...@@ -19,6 +19,19 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -19,6 +19,19 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
redirect_to admin_runners_path redirect_to admin_runners_path
end end
def clear_repository_check_states
Project.update_all(
last_repository_check_failed: false,
last_repository_check_at: nil
)
redirect_to(
admin_application_settings_path,
notice: 'All repository check states were cleared'
)
end
private private
def set_application_setting def set_application_setting
...@@ -82,6 +95,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -82,6 +95,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:akismet_enabled, :akismet_enabled,
:akismet_api_key, :akismet_api_key,
:email_author_in_body, :email_author_in_body,
:repository_checks_enabled,
restricted_visibility_levels: [], restricted_visibility_levels: [],
import_sources: [] import_sources: []
) )
......
...@@ -40,18 +40,6 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -40,18 +40,6 @@ class Admin::ProjectsController < Admin::ApplicationController
) )
end end
def clear_repository_check_states
Project.update_all(
last_repository_check_failed: false,
last_repository_check_at: nil
)
redirect_to(
admin_namespaces_projects_path,
notice: 'All project states were cleared'
)
end
protected protected
def project def project
......
...@@ -287,6 +287,12 @@ ...@@ -287,6 +287,12 @@
GitLab will periodically run GitLab will periodically run
%a{ href: 'https://www.kernel.org/pub/software/scm/git/docs/git-fsck.html', target: 'blank' } 'git fsck' %a{ href: 'https://www.kernel.org/pub/software/scm/git/docs/git-fsck.html', target: 'blank' } 'git fsck'
in all project and wiki repositories to look for silent disk corruption issues. in all project and wiki repositories to look for silent disk corruption issues.
.form-group
.col-sm-offset-2.col-sm-10
= link_to 'Clear all repository checks', clear_repository_check_states_admin_application_settings_path, data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove"
.help-block
If you got a lot of false alarms from repository checks (maybe your fileserver was temporarily unavailable) you can choose to clear all repository check information from the database.
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = f.submit 'Save', class: 'btn btn-save'
...@@ -49,11 +49,6 @@ ...@@ -49,11 +49,6 @@
= button_tag "Search", class: "btn submit btn-primary" = button_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel" = link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel"
.panel.panel-default.repository-check-states
.panel-heading
Repository check states
.panel-body
= link_to 'Clear all', clear_repository_check_states_admin_namespace_projects_path(0), data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove"
%section.col-md-9 %section.col-md-9
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
......
...@@ -267,10 +267,6 @@ Rails.application.routes.draw do ...@@ -267,10 +267,6 @@ Rails.application.routes.draw do
post :repository_check post :repository_check
end end
collection do
put :clear_repository_check_states
end
resources :runner_projects resources :runner_projects
end end
end end
...@@ -286,6 +282,7 @@ Rails.application.routes.draw do ...@@ -286,6 +282,7 @@ Rails.application.routes.draw do
resource :application_settings, only: [:show, :update] do resource :application_settings, only: [:show, :update] do
resources :services resources :services
put :reset_runners_token put :reset_runners_token
put :clear_repository_check_states
end end
resources :labels resources :labels
......
...@@ -4,12 +4,13 @@ _**Note:** This feature was [introduced][ce-3232] in GitLab 8.7_ ...@@ -4,12 +4,13 @@ _**Note:** This feature was [introduced][ce-3232] in GitLab 8.7_
--- ---
Git has a built-in mechanism [git fsck][git-fsck] to verify the Git has a built-in mechanism \[git fsck\]\[git-fsck\] to verify the
integrity of all data commited to a repository. GitLab administrators can integrity of all data commited to a repository. GitLab administrators
trigger such a check for a project via the admin panel. The checks run can trigger such a check for a project via the project page under the
asynchronously so it may take a few minutes before the check result is admin panel. The checks run asynchronously so it may take a few minutes
visible on the project admin page. If the checks failed you can see their before the check result is visible on the project admin page. If the
output on the admin log page under 'repocheck.log'. checks failed you can see their output on the admin log page under
'repocheck.log'.
## Periodical checks ## Periodical checks
...@@ -22,20 +23,8 @@ than once a day. ...@@ -22,20 +23,8 @@ than once a day.
## Disabling periodic checks ## Disabling periodic checks
You can disable the periodic checks by giving them an empty cron You can disable the periodic checks on the 'Settings' page of the admin
schedule in gitlab.yml. panel.
```
# For omnibus installations, in /etc/gitlab/gitlab.rb:
gitlab_rails['cron_jobs_repository_check_worker_cron'] = ''
```
```
# For installations from source, in config/gitlab.yml:
cron_jobs:
repository_check_worker:
cron: ""
```
## What to do if a check failed ## What to do if a check failed
...@@ -47,8 +36,8 @@ resolved the issue use the admin panel to trigger a new repository check on ...@@ -47,8 +36,8 @@ resolved the issue use the admin panel to trigger a new repository check on
the project. This will clear the 'check failed' state. the project. This will clear the 'check failed' state.
If for some reason the periodical repository check caused a lot of false If for some reason the periodical repository check caused a lot of false
alarms you can choose to clear ALL repository check states from the admin alarms you can choose to clear ALL repository check states from the
project index page. 'Settings' page of the admin panel.
--- ---
[ce-3232]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3232 "Auto git fsck" [ce-3232]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3232 "Auto git fsck"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment