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
1b74918a
Commit
1b74918a
authored
Jun 23, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forces import worker with mirror to insert mirror in front of queue
parent
ac44a89e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
6 deletions
+24
-6
app/workers/repository_import_worker.rb
app/workers/repository_import_worker.rb
+2
-2
app/workers/update_all_mirrors_worker.rb
app/workers/update_all_mirrors_worker.rb
+3
-2
changelogs/unreleased-ee/remove-force-mirror-scheduling-from-project-import-worker.yml
...ve-force-mirror-scheduling-from-project-import-worker.yml
+4
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
spec/workers/repository_import_worker_spec.rb
spec/workers/repository_import_worker_spec.rb
+13
-0
No files found.
app/workers/repository_import_worker.rb
View file @
1b74918a
...
...
@@ -26,9 +26,9 @@ class RepositoryImportWorker
project
.
repository
.
after_import
project
.
import_finish
# Explicitly
schedul
e mirror for update so
# Explicitly
enqueu
e mirror for update so
# that upstream remote is created and fetched
project
.
import_schedule
if
project
.
mirror?
project
.
force_import_job!
if
project
.
mirror?
rescue
ImportError
=>
ex
fail_import
(
project
,
ex
.
message
)
raise
...
...
app/workers/update_all_mirrors_worker.rb
View file @
1b74918a
...
...
@@ -15,8 +15,9 @@ class UpdateAllMirrorsWorker
fail_stuck_mirrors!
return
if
Gitlab
::
Mirror
.
max_mirror_capacity_reached?
Project
.
mirrors_to_sync
.
find_each
(
batch_size:
200
,
&
:import_schedule
)
unless
Gitlab
::
Mirror
.
max_mirror_capacity_reached?
Project
.
mirrors_to_sync
.
find_each
(
batch_size:
200
,
&
:import_schedule
)
end
cancel_lease
(
lease_uuid
)
end
...
...
changelogs/unreleased-ee/remove-force-mirror-scheduling-from-project-import-worker.yml
0 → 100644
View file @
1b74918a
---
title
:
Forces import worker with mirror to insert mirror in front of queue
merge_request
:
2231
author
:
spec/models/project_spec.rb
View file @
1b74918a
...
...
@@ -1744,9 +1744,9 @@ describe Project, models: true do
context
'with a mirrored project'
do
let
(
:project
)
{
create
(
:empty_project
,
:mirror
)
}
it
'
first calls RepositoryImportWorker and RepositoryUpdateMirrorWorker after
'
do
it
'
calls RepositoryImportWorker and inserts in front of the mirror scheduler queue
'
do
allow_any_instance_of
(
Project
).
to
receive
(
:repository_exists?
).
and_return
(
false
,
true
)
expect_any_instance_of
(
RepositoryUpdateMirrorWorker
).
to
receive
(
:perform
).
with
(
project
.
id
)
expect_any_instance_of
(
EE
::
Project
).
to
receive
(
:force_import_job!
)
expect_any_instance_of
(
RepositoryImportWorker
).
to
receive
(
:perform
).
with
(
project
.
id
).
and_call_original
project
.
import_schedule
...
...
spec/workers/repository_import_worker_spec.rb
View file @
1b74918a
...
...
@@ -18,6 +18,19 @@ describe RepositoryImportWorker do
end
end
context
'when project is a mirror'
do
let
(
:project
)
{
create
(
:empty_project
,
:mirror
,
:import_scheduled
)
}
it
'adds mirror in front of the mirror scheduler queue'
do
expect_any_instance_of
(
Projects
::
ImportService
).
to
receive
(
:execute
)
.
and_return
({
status: :ok
})
expect_any_instance_of
(
EE
::
Project
).
to
receive
(
:force_import_job!
)
subject
.
perform
(
project
.
id
)
end
end
context
'when the import has failed'
do
it
'hide the credentials that were used in the import URL'
do
error
=
%q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
...
...
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