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
5e366b1a
Commit
5e366b1a
authored
Jan 05, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make fetch worker forward-compatible
We will use this hook name in future, but with a better implementation.
parent
d27c5f82
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
30 deletions
+6
-30
app/models/hooks/system_hook.rb
app/models/hooks/system_hook.rb
+1
-1
app/workers/geo_repository_fetch_worker.rb
app/workers/geo_repository_fetch_worker.rb
+0
-1
app/workers/geo_repository_update_worker.rb
app/workers/geo_repository_update_worker.rb
+0
-2
app/workers/post_receive.rb
app/workers/post_receive.rb
+4
-3
lib/api/geo.rb
lib/api/geo.rb
+1
-1
spec/workers/geo_repository_fetch_worker_spec.rb
spec/workers/geo_repository_fetch_worker_spec.rb
+0
-1
spec/workers/geo_repository_update_worker_spec.rb
spec/workers/geo_repository_update_worker_spec.rb
+0
-21
No files found.
app/models/hooks/system_hook.rb
View file @
5e366b1a
...
...
@@ -3,7 +3,7 @@ class SystemHook < WebHook
Sidekiq
::
Client
.
enqueue
(
SystemHookWorker
,
id
,
data
,
hook_name
)
end
def
self
.
fetch
_hooks
def
self
.
repository_update
_hooks
GeoNode
.
where
(
primary:
false
).
map
(
&
:system_hook
)
end
end
app/workers/geo_repository_fetch_worker.rb
View file @
5e366b1a
# TODO: Remove me once Geo is fixed
class
GeoRepositoryFetchWorker
include
Sidekiq
::
Worker
include
Gitlab
::
ShellAdapter
...
...
app/workers/geo_repository_update_worker.rb
View file @
5e366b1a
...
...
@@ -9,8 +9,6 @@ class GeoRepositoryUpdateWorker
@project
=
Project
.
find
(
project_id
)
@push_data
=
push_data
# TODO: Enable fetch once Geo is fixed
# fetch_repository(clone_url)
process_hooks
if
push_data
# we should be compatible with old unprocessed data
end
...
...
app/workers/post_receive.rb
View file @
5e366b1a
...
...
@@ -27,15 +27,16 @@ class PostReceive
# Triggers repository update on secondary nodes when Geo is enabled
Gitlab
::
Geo
.
notify_wiki_update
(
post_received
.
project
)
if
Gitlab
::
Geo
.
enabled?
elsif
post_received
.
regular_project?
# TODO:
Remove this if block once Geo is fixed
# TODO:
gitlab-org/gitlab-ce#26325. Remove this.
if
Gitlab
::
Geo
.
enabled?
hook_data
=
{
event_name:
'repository_update'
,
project_id:
post_received
.
project
.
id
,
event_name:
'trigger_fetch'
,
project:
project
.
hook_attrs
,
remote_url:
post_received
.
project
.
ssh_url_to_repo
}
SystemHooksService
.
new
.
execute_hooks
(
hook_data
,
:
fetch_hooks
)
SystemHooksService
.
new
.
execute_hooks
(
hook_data
,
:
repository_update
)
end
process_project_changes
(
post_received
)
...
...
lib/api/geo.rb
View file @
5e366b1a
...
...
@@ -24,7 +24,7 @@ module API
when
'key_create'
,
'key_destroy'
required_attributes!
%w(key id)
::
Geo
::
ScheduleKeyChangeService
.
new
(
params
).
execute
when
'
trigger_fetch
'
when
'
repository_update
'
required_attributes!
%w(event_name project_id remote_url)
::
Geo
::
ScheduleRepoFetchService
.
new
(
params
).
execute
when
'push'
...
...
spec/workers/geo_repository_fetch_worker_spec.rb
View file @
5e366b1a
require
'spec_helper'
# TODO: Remove me once Geo is fixed
describe
GeoRepositoryFetchWorker
do
describe
'#perform'
do
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
spec/workers/geo_repository_update_worker_spec.rb
View file @
5e366b1a
...
...
@@ -30,27 +30,6 @@ describe GeoRepositoryUpdateWorker do
expect
(
Project
).
to
receive
(
:find
).
at_least
(
:once
).
with
(
project
.
id
)
{
project
}
end
context
'when no repository'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:fetch_geo_mirror
)
allow
(
project
).
to
receive
(
:repository_exists?
)
{
false
}
end
# TODO: Enable again once Geo update has been properly fixed.
# See !1015 for more info
xit
'creates a new repository'
do
expect
(
project
).
to
receive
(
:create_repository
)
performed
end
xit
'executes after_create hook'
do
expect
(
project
.
repository
).
to
receive
(
:after_create
)
performed
end
end
context
'when empty repository'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:fetch_geo_mirror
)
...
...
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