Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
754a8502
Commit
754a8502
authored
Jul 25, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable recheck, resync and forced redownload
parent
c3ed82b5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
5 deletions
+59
-5
config/routes/admin.rb
config/routes/admin.rb
+5
-0
ee/app/controllers/admin/geo_nodes_controller.rb
ee/app/controllers/admin/geo_nodes_controller.rb
+24
-1
ee/app/models/geo/project_registry.rb
ee/app/models/geo/project_registry.rb
+15
-0
ee/app/views/admin/geo_nodes/_all.html.haml
ee/app/views/admin/geo_nodes/_all.html.haml
+3
-2
ee/lib/ee/gitlab/middleware/read_only/controller.rb
ee/lib/ee/gitlab/middleware/read_only/controller.rb
+12
-2
No files found.
config/routes/admin.rb
View file @
754a8502
...
...
@@ -138,6 +138,11 @@ namespace :admin do
end
collection
do
get
:projects
scope
(
path:
'projects/:id'
)
do
post
:recheck_project
,
action: :recheck
post
:resync_project
,
action: :resync
post
:force_redownload_project
,
action: :force_redownload
end
end
end
...
...
ee/app/controllers/admin/geo_nodes_controller.rb
View file @
754a8502
...
...
@@ -15,6 +15,7 @@ class Admin::GeoNodesController < Admin::ApplicationController
def
projects
finder
=
Geo
::
ProjectRegistryStatusFinder
.
new
case
params
[
:sync_status
]
when
'never'
@projects
=
finder
.
never_synced_projects
.
page
(
params
[
:page
])
...
...
@@ -25,8 +26,30 @@ class Admin::GeoNodesController < Admin::ApplicationController
else
@registries
=
finder
.
synced_projects
.
page
(
params
[
:page
])
end
end
def
recheck
@registry
=
Geo
::
ProjectRegistry
.
find_by_id
(
params
[
:id
])
@registry
.
flag_repository_for_recheck
flash
[
:notice
]
=
"
#{
@registry
.
project
.
full_name
}
is scheduled for recheck"
redirect_to
projects_admin_geo_nodes_path
end
def
resync
@registry
=
Geo
::
ProjectRegistry
.
find_by_id
(
params
[
:id
])
@registry
.
flag_repository_for_resync
flash
[
:notice
]
=
"
#{
@registry
.
project
.
full_name
}
is scheduled for resync"
redirect_to
projects_admin_geo_nodes_path
end
def
force_redownload
@registry
=
Geo
::
ProjectRegistry
.
find_by_id
(
params
[
:id
])
@registry
.
flag_repository_for_redownload
flash
[
:notice
]
=
"
#{
@registry
.
project
.
full_name
}
is scheduled for forced redownload"
# Gitlab::Geo.current_node.projects.includes(:project_registry).page(params[:page])
redirect_to
projects_admin_geo_nodes_path
end
def
create
...
...
ee/app/models/geo/project_registry.rb
View file @
754a8502
...
...
@@ -201,6 +201,21 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
public_send
(
"
#{
type
}
_verification_retry_count"
).
to_i
# rubocop:disable GitlabSecurity/PublicSend
end
# Flag the repository to be rechecked
def
flag_repository_for_recheck
self
.
update
(
repository_verification_checksum_sha:
nil
)
end
# Flag the repository to be resynced
def
flag_repository_for_resync
self
.
update
(
resync_repository:
true
)
end
# Flag the repository to perform a full redownload
def
flag_repository_for_redownload
self
.
update
(
resync_repository:
true
,
force_to_redownload_repository:
true
)
end
private
def
fetches_since_gc_redis_key
...
...
ee/app/views/admin/geo_nodes/_all.html.haml
View file @
754a8502
...
...
@@ -7,8 +7,9 @@
=
sprite_icon
(
'chevron-up'
,
size:
18
,
css_class:
'card-collapse-icon'
)
%strong
.header-text
=
project_registry
.
project
.
name
%button
.btn.btn-outline-primary.btn-sm
{
type:
'button'
}
Resync
=
link_to
(
resync_project_admin_geo_nodes_path
(
project_registry
),
method: :post
)
do
%button
.btn.btn-outline-primary.btn-sm
{
type:
'button'
}
Resync
.collapse.show
{
id:
"project-#{project_registry.project.id}"
,
'aria-labelledby'
=>
"project-#{project_registry.project.id}-header"
}
.card-body
...
...
ee/lib/ee/gitlab/middleware/read_only/controller.rb
View file @
754a8502
...
...
@@ -9,6 +9,10 @@ module EE
'admin/geo_nodes'
=>
%w{update}
}.
freeze
WHITELISTED_GEO_ROUTES_TRACKING_DB
=
{
'admin/geo_nodes'
=>
%w{resync recheck force_redownload}
}.
freeze
private
override
:whitelisted_routes
...
...
@@ -20,8 +24,14 @@ module EE
# Calling route_hash may be expensive. Only do it if we think there's a possible match
return
false
unless
request
.
path
=~
%r{/admin/geo_nodes}
::
Gitlab
::
Database
.
db_read_write?
&&
WHITELISTED_GEO_ROUTES
[
route_hash
[
:controller
]]
&
.
include?
(
route_hash
[
:action
])
controller
=
route_hash
[
:controller
]
action
=
route_hash
[
:action
]
if
WHITELISTED_GEO_ROUTES
[
controller
]
&
.
include?
(
action
)
return
::
Gitlab
::
Database
.
db_read_write?
end
WHITELISTED_GEO_ROUTES_TRACKING_DB
[
controller
]
&
.
include?
(
action
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment