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
90719161
Commit
90719161
authored
Dec 08, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replicate repository creation in Geo secondary node
parent
904981f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
0 deletions
+51
-0
app/services/geo/schedule_repo_create_service.rb
app/services/geo/schedule_repo_create_service.rb
+13
-0
app/workers/geo_repository_create_worker.rb
app/workers/geo_repository_create_worker.rb
+11
-0
changelogs/unreleased-ee/1071-geo-replicate-repository-creation.yml
.../unreleased-ee/1071-geo-replicate-repository-creation.yml
+4
-0
lib/api/geo.rb
lib/api/geo.rb
+3
-0
spec/workers/geo_repository_create_worker_spec.rb
spec/workers/geo_repository_create_worker_spec.rb
+20
-0
No files found.
app/services/geo/schedule_repo_create_service.rb
0 → 100644
View file @
90719161
module
Geo
class
ScheduleRepoCreateService
attr_reader
:id
def
initialize
(
params
)
@id
=
params
[
'project_id'
]
end
def
execute
GeoRepositoryCreateWorker
.
perform_async
(
id
)
end
end
end
app/workers/geo_repository_create_worker.rb
0 → 100644
View file @
90719161
class
GeoRepositoryCreateWorker
include
Sidekiq
::
Worker
include
GeoQueue
def
perform
(
id
)
project
=
Project
.
find
(
id
)
project
.
ensure_dir_exist
project
.
create_repository
unless
project
.
repository_exists?
end
end
changelogs/unreleased-ee/1071-geo-replicate-repository-creation.yml
0 → 100644
View file @
90719161
---
title
:
'
Geo:
Replicate
repository
creation
in
Geo
secondary
node'
merge_request
:
952
author
:
lib/api/geo.rb
View file @
90719161
...
...
@@ -33,6 +33,9 @@ module API
when
'tag_push'
required_attributes!
%w(event_name project_id project)
::
Geo
::
ScheduleWikiRepoUpdateService
.
new
(
params
).
execute
when
'project_create'
required_attributes!
%w(event_name project_id)
::
Geo
::
ScheduleRepoCreateService
.
new
(
params
).
execute
when
'project_destroy'
required_attributes!
%w(event_name project_id path_with_namespace)
::
Geo
::
ScheduleRepoDestroyService
.
new
(
params
).
execute
...
...
spec/workers/geo_repository_create_worker_spec.rb
0 → 100644
View file @
90719161
require
'spec_helper'
describe
GeoRepositoryCreateWorker
do
let
(
:user
)
{
create
:user
}
let
(
:project
)
{
create
:project
}
let
(
:perform!
)
{
subject
.
perform
(
project
.
id
)
}
context
'when no repository'
do
before
do
expect
(
Project
).
to
receive
(
:find
).
at_least
(
:once
).
with
(
project
.
id
)
{
project
}
expect
(
project
).
to
receive
(
:repository_exists?
)
{
false
}
end
it
'creates the repository'
do
expect
(
project
).
to
receive
(
:create_repository
)
perform!
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