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
5ca23e98
Commit
5ca23e98
authored
May 20, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
74458b1c
5f261b62
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
67 deletions
+116
-67
app/services/git/base_hooks_service.rb
app/services/git/base_hooks_service.rb
+9
-0
app/services/git/branch_push_service.rb
app/services/git/branch_push_service.rb
+0
-1
changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml
changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml
+5
-0
spec/services/git/base_hooks_service_spec.rb
spec/services/git/base_hooks_service_spec.rb
+90
-0
spec/services/git/branch_hooks_service_spec.rb
spec/services/git/branch_hooks_service_spec.rb
+6
-0
spec/services/git/branch_push_service_spec.rb
spec/services/git/branch_push_service_spec.rb
+0
-66
spec/services/git/tag_hooks_service_spec.rb
spec/services/git/tag_hooks_service_spec.rb
+6
-0
No files found.
app/services/git/base_hooks_service.rb
View file @
5ca23e98
...
...
@@ -17,6 +17,8 @@ module Git
# Not a hook, but it needs access to the list of changed commits
enqueue_invalidate_cache
update_remote_mirrors
push_data
end
...
...
@@ -92,5 +94,12 @@ module Git
def
pipeline_options
{}
end
def
update_remote_mirrors
return
unless
project
.
has_remote_mirror?
project
.
mark_stuck_remote_mirrors_as_failed!
project
.
update_remote_mirrors
end
end
end
app/services/git/branch_push_service.rb
View file @
5ca23e98
...
...
@@ -27,7 +27,6 @@ module Git
execute_related_hooks
perform_housekeeping
update_remote_mirrors
stop_environments
true
...
...
changelogs/unreleased/sh-fix-tag-push-remote-mirror.yml
0 → 100644
View file @
5ca23e98
---
title
:
Fix remote mirrors not updating after tag push
merge_request
:
author
:
type
:
fixed
spec/services/git/base_hooks_service_spec.rb
0 → 100644
View file @
5ca23e98
# frozen_string_literal: true
require
'spec_helper'
describe
Git
::
BaseHooksService
do
include
RepoHelpers
include
GitHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
}
let
(
:oldrev
)
{
Gitlab
::
Git
::
BLANK_SHA
}
let
(
:newrev
)
{
"8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b"
}
# gitlab-test: git rev-parse refs/tags/v1.1.0
let
(
:ref
)
{
'refs/tags/v1.1.0'
}
describe
'with remote mirrors'
do
class
TestService
<
described_class
def
commits
[]
end
end
let
(
:project
)
{
create
(
:project
,
:repository
,
:remote_mirror
)
}
subject
{
TestService
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
}
before
do
expect
(
subject
).
to
receive
(
:execute_project_hooks
)
end
context
'when remote mirror feature is enabled'
do
it
'fails stuck remote mirrors'
do
allow
(
project
).
to
receive
(
:update_remote_mirrors
).
and_return
(
project
.
remote_mirrors
)
expect
(
project
).
to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'updates remote mirrors'
do
expect
(
project
).
to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
context
'when remote mirror feature is disabled'
do
before
do
stub_application_setting
(
mirror_available:
false
)
end
context
'with remote mirrors global setting overridden'
do
before
do
project
.
remote_mirror_available_overridden
=
true
end
it
'fails stuck remote mirrors'
do
allow
(
project
).
to
receive
(
:update_remote_mirrors
).
and_return
(
project
.
remote_mirrors
)
expect
(
project
).
to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'updates remote mirrors'
do
expect
(
project
).
to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
context
'without remote mirrors global setting overridden'
do
before
do
project
.
remote_mirror_available_overridden
=
false
end
it
'does not fails stuck remote mirrors'
do
expect
(
project
).
not_to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'does not updates remote mirrors'
do
expect
(
project
).
not_to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
end
end
end
spec/services/git/branch_hooks_service_spec.rb
View file @
5ca23e98
...
...
@@ -18,6 +18,12 @@ describe Git::BranchHooksService do
described_class
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
end
it
'update remote mirrors'
do
expect
(
service
).
to
receive
(
:update_remote_mirrors
).
and_call_original
service
.
execute
end
describe
"Git Push Data"
do
subject
(
:push_data
)
{
service
.
execute
}
...
...
spec/services/git/branch_push_service_spec.rb
View file @
5ca23e98
...
...
@@ -17,72 +17,6 @@ describe Git::BranchPushService, services: true do
project
.
add_maintainer
(
user
)
end
describe
'with remote mirrors'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:remote_mirror
)
}
subject
do
described_class
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
end
context
'when remote mirror feature is enabled'
do
it
'fails stuck remote mirrors'
do
allow
(
project
).
to
receive
(
:update_remote_mirrors
).
and_return
(
project
.
remote_mirrors
)
expect
(
project
).
to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'updates remote mirrors'
do
expect
(
project
).
to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
context
'when remote mirror feature is disabled'
do
before
do
stub_application_setting
(
mirror_available:
false
)
end
context
'with remote mirrors global setting overridden'
do
before
do
project
.
remote_mirror_available_overridden
=
true
end
it
'fails stuck remote mirrors'
do
allow
(
project
).
to
receive
(
:update_remote_mirrors
).
and_return
(
project
.
remote_mirrors
)
expect
(
project
).
to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'updates remote mirrors'
do
expect
(
project
).
to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
context
'without remote mirrors global setting overridden'
do
before
do
project
.
remote_mirror_available_overridden
=
false
end
it
'does not fails stuck remote mirrors'
do
expect
(
project
).
not_to
receive
(
:mark_stuck_remote_mirrors_as_failed!
)
subject
.
execute
end
it
'does not updates remote mirrors'
do
expect
(
project
).
not_to
receive
(
:update_remote_mirrors
)
subject
.
execute
end
end
end
end
describe
'Push branches'
do
subject
do
execute_service
(
project
,
user
,
oldrev
,
newrev
,
ref
)
...
...
spec/services/git/tag_hooks_service_spec.rb
View file @
5ca23e98
...
...
@@ -18,6 +18,12 @@ describe Git::TagHooksService, :service do
described_class
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
end
it
'update remote mirrors'
do
expect
(
service
).
to
receive
(
:update_remote_mirrors
).
and_call_original
service
.
execute
end
describe
'System hooks'
do
it
'Executes system hooks'
do
push_data
=
service
.
execute
...
...
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