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
ea87a772
Commit
ea87a772
authored
Feb 04, 2020
by
David Kim
Committed by
Mayra Cabrera
Feb 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable mirror importing when the project is archived
parent
d4a9566e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
1 deletion
+36
-1
changelogs/unreleased/25970-mirror-pull-for-archived-projects.yml
...gs/unreleased/25970-mirror-pull-for-archived-projects.yml
+5
-0
ee/app/models/ee/project_import_state.rb
ee/app/models/ee/project_import_state.rb
+1
-0
ee/app/views/projects/mirrors/_table_pull_row.html.haml
ee/app/views/projects/mirrors/_table_pull_row.html.haml
+1
-1
ee/app/workers/update_all_mirrors_worker.rb
ee/app/workers/update_all_mirrors_worker.rb
+1
-0
ee/spec/models/project_import_state_spec.rb
ee/spec/models/project_import_state_spec.rb
+18
-0
ee/spec/workers/update_all_mirrors_worker_spec.rb
ee/spec/workers/update_all_mirrors_worker_spec.rb
+10
-0
No files found.
changelogs/unreleased/25970-mirror-pull-for-archived-projects.yml
0 → 100644
View file @
ea87a772
---
title
:
Disable pull mirror importing for archived projects
merge_request
:
24029
author
:
type
:
fixed
ee/app/models/ee/project_import_state.rb
View file @
ea87a772
...
...
@@ -97,6 +97,7 @@ module EE
def
mirror_update_due?
return
false
unless
project
.
mirror_with_content?
return
false
if
project
.
archived?
return
false
if
hard_failed?
return
false
if
updating_mirror?
...
...
ee/app/views/projects/mirrors/_table_pull_row.html.haml
View file @
ea87a772
...
...
@@ -22,7 +22,7 @@
=
clipboard_button
(
text:
ssh_public_key
,
class:
'btn btn-default rspec-copy-ssh-public-key'
,
title:
_
(
'Copy SSH public key'
),
qa_selector:
'copy_public_key_button'
)
-
if
import_state
.
mirror_update_due?
||
import_state
.
updating_mirror?
%button
.btn.disabled
{
type:
'button'
,
data:
{
container:
'body'
,
toggle:
'tooltip'
,
qa_selector:
'updating_button'
},
title:
_
(
'Updating'
)
}=
icon
(
"refresh spin"
)
-
els
e
-
els
if
!
@project
.
archived?
=
link_to
update_now_project_mirror_path
(
@project
),
method: :post
,
class:
'btn js-force-update-mirror'
,
data:
{
container:
'body'
,
toggle:
'tooltip'
,
qa_selector:
'update_now_button'
},
title:
_
(
'Update now'
)
do
=
icon
(
"refresh"
)
%button
.js-delete-mirror.js-delete-pull-mirror.btn.btn-danger
{
type:
'button'
,
data:
{
toggle:
'tooltip'
,
container:
'body'
},
title:
_
(
'Remove'
)
}=
icon
(
'trash-o'
)
ee/app/workers/update_all_mirrors_worker.rb
View file @
ea87a772
...
...
@@ -93,6 +93,7 @@ class UpdateAllMirrorsWorker
# rubocop: disable CodeReuse/ActiveRecord
def
pull_mirrors_batch
(
freeze_at
:,
batch_size
:,
offset_at:
nil
)
relation
=
Project
.
non_archived
.
mirrors_to_sync
(
freeze_at
)
.
reorder
(
'import_state.next_execution_timestamp'
)
.
limit
(
batch_size
)
...
...
ee/spec/models/project_import_state_spec.rb
View file @
ea87a772
...
...
@@ -230,6 +230,24 @@ describe ProjectImportState, type: :model do
end
end
context
'when the project is archived'
do
let
(
:import_state
)
do
create
(
:import_state
,
:finished
,
:mirror
,
:repository
,
next_execution_timestamp:
Time
.
now
-
2
.
minutes
)
end
before
do
import_state
.
project
.
update!
(
archived:
true
)
end
it
'returns false'
do
expect
(
import_state
.
mirror_update_due?
).
to
be
false
end
end
context
'when mirror has no content'
do
it
'returns false'
do
import_state
=
create
(
:import_state
,
:finished
,
:mirror
)
...
...
ee/spec/workers/update_all_mirrors_worker_spec.rb
View file @
ea87a772
...
...
@@ -182,6 +182,16 @@ describe UpdateAllMirrorsWorker do
schedule_mirrors!
(
capacity:
4
)
end
it
"does not schedule a mirror of an archived project"
do
licensed_project1
.
update!
(
archived:
true
)
schedule_mirrors!
(
capacity:
4
)
expect_import_scheduled
(
licensed_project2
,
licensed_project3
)
expect_import_not_scheduled
(
licensed_project1
)
expect_import_not_scheduled
(
*
unlicensed_projects
)
end
end
context
'when capacity is exacly sufficient'
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