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
e0635c39
Commit
e0635c39
authored
Jun 29, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves documentation regarding the pull mirror feature
parent
214470ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
20 deletions
+45
-20
app/models/ee/project.rb
app/models/ee/project.rb
+4
-3
app/views/shared/_mirror_update_button.html.haml
app/views/shared/_mirror_update_button.html.haml
+1
-0
doc/workflow/repository_mirroring.md
doc/workflow/repository_mirroring.md
+17
-4
spec/models/project_spec.rb
spec/models/project_spec.rb
+23
-13
No files found.
app/models/ee/project.rb
View file @
e0635c39
...
...
@@ -85,13 +85,14 @@ module EE
end
def
mirror_with_content?
mirror?
&&
!
empty_repo
mirror?
&&
!
empty_repo
?
end
def
scheduled_mirror?
enqueued
=
self
.
mirror_data
.
next_execution_timestamp
<
Time
.
now
return
false
unless
mirror_with_content?
return
true
if
import_scheduled?
mirror_with_content?
&&
import_scheduled?
&&
enqueued
self
.
mirror_data
.
next_execution_timestamp
<=
Time
.
now
end
def
updating_mirror?
...
...
app/views/shared/_mirror_update_button.html.haml
View file @
e0635c39
-
if
@project
.
mirror?
&&
can?
(
current_user
,
:push_code
,
@project
)
.append-bottom-default
-
if
@project
.
scheduled_mirror?
%span
.btn.disabled
=
icon
(
"refresh spin"
)
Update Scheduled
…
-
elsif
@project
.
updating_mirror?
...
...
doc/workflow/repository_mirroring.md
View file @
e0635c39
...
...
@@ -6,8 +6,8 @@ Repository Mirroring is a way to mirror repositories from external sources.
It can be used to mirror all branches, tags, and commits that you have
in your repository.
Your mirror at GitLab will be updated automatically
once an hour, but y
ou can
also manually
update it whenever you need
.
Your mirror at GitLab will be updated automatically
. Y
ou can
also manually
trigger an update at most once every 5 minutes
.
## Overview
...
...
@@ -19,10 +19,11 @@ There are two kinds of repository mirroring features supported by GitLab:
to another location, whereas the
**pull**
method mirrors an external repository
in one in GitLab.
By default, mirror repositories are updated every hour, and
all new branches,
Once the mirror repository is updated,
all new branches,
tags, and commits will be visible in the project's activity feed.
Users with at least
[
developer access
][
perms
]
to the project can also force an
immediate update with a click of a button.
immediate update with the click of a button. This button will not be available if
the mirror is already being updated or 5 minutes still haven't passed since its last update.
A few things/limitations to consider:
...
...
@@ -82,6 +83,18 @@ this branch to prevent any changes from being lost.
![
Diverged branch
](
repository_mirroring/repository_mirroring_diverged_branch.png
)
## How it works
Once you activate the pull mirroring feature, the mirror will be inserted into a queue.
A scheduler will start every minute and schedule a fixed amount of mirrors for update, based
on the configured maximum capacity.
If the mirror successfully updates it will be enqueued once again with a small backoff
period.
If the mirror fails (eg: branch diverged from upstream), the project's
backoff period will be penalized each time it fails up to a maximum amount of time.
## Pushing to a remote repository
For an existing project, you can set up mirror pushing by visiting your project's
...
...
spec/models/project_spec.rb
View file @
e0635c39
...
...
@@ -1864,6 +1864,28 @@ describe Project, models: true do
end
end
describe
'#scheduled_mirror?'
do
context
'when mirror is expected to run soon'
do
it
'returns true'
do
timestamp
=
Time
.
now
project
=
create
(
:project
,
:mirror
,
:import_finished
)
project
.
mirror_last_update_at
=
timestamp
-
3
.
minutes
project
.
mirror_data
.
next_execution_timestamp
=
timestamp
-
2
.
minutes
expect
(
project
.
scheduled_mirror?
).
to
be
true
end
end
context
'when mirror was scheduled'
do
it
'returns true'
do
project
=
create
(
:project
,
:mirror
,
:import_scheduled
)
expect
(
project
.
scheduled_mirror?
).
to
be
true
end
end
end
describe
'#updating_mirror?'
do
context
'when repository is empty'
do
it
'returns false'
do
...
...
@@ -1881,25 +1903,13 @@ describe Project, models: true do
end
end
context
'when
project
is in progress'
do
context
'when
mirror
is in progress'
do
it
'returns true'
do
project
=
create
(
:project
,
:mirror
,
:import_started
)
expect
(
project
.
updating_mirror?
).
to
be
true
end
end
context
'when project is expected to run soon'
do
it
'returns true'
do
timestamp
=
Time
.
now
project
=
create
(
:project
,
:mirror
,
:import_finished
)
project
.
mirror_last_update_at
=
timestamp
-
3
.
minutes
project
.
mirror_data
.
next_execution_timestamp
=
timestamp
-
2
.
minutes
expect
(
project
.
updating_mirror?
).
to
be
true
end
end
end
describe
'#force_import_job!'
do
...
...
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