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
cf786e63
Commit
cf786e63
authored
May 25, 2021
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove :find_remote_root_refs_inmemory feature flag
Changelog: other
parent
10139b88
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
145 deletions
+37
-145
config/feature_flags/development/find_remote_root_refs_inmemory.yml
...ture_flags/development/find_remote_root_refs_inmemory.yml
+0
-8
ee/app/services/geo/repository_sync_service.rb
ee/app/services/geo/repository_sync_service.rb
+4
-10
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+15
-79
lib/gitlab/gitaly_client/remote_service.rb
lib/gitlab/gitaly_client/remote_service.rb
+3
-12
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
+15
-36
No files found.
config/feature_flags/development/find_remote_root_refs_inmemory.yml
deleted
100644 → 0
View file @
10139b88
---
name
:
find_remote_root_refs_inmemory
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60583
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/329664
milestone
:
'
13.12'
type
:
development
group
:
group::gitaly
default_enabled
:
true
ee/app/services/geo/repository_sync_service.rb
View file @
cf786e63
...
...
@@ -50,17 +50,11 @@ module Geo
end
def
update_root_ref
if
Feature
.
enabled?
(
:find_remote_root_refs_inmemory
,
default_enabled: :yaml
)
authorization
=
::
Gitlab
::
Geo
::
RepoSyncRequest
.
new
(
scope:
repository
.
full_path
).
authorization
authorization
=
::
Gitlab
::
Geo
::
RepoSyncRequest
.
new
(
scope:
repository
.
full_path
).
authorization
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
,
authorization
)
else
repository
.
with_config
(
jwt_authentication_header
)
do
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
,
nil
)
end
end
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
,
authorization
)
end
def
execute_housekeeping
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
cf786e63
...
...
@@ -233,93 +233,29 @@ RSpec.describe Geo::RepositorySyncService, :geo do
context
'with non empty repositories'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'w
ith inmemory feature disabled
'
do
context
'w
hen HEAD change
'
do
before
do
stub_feature_flags
(
find_remote_root_refs_inmemory:
false
)
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
'feature'
)
end
context
'when HEAD change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
nil
)
.
and_return
(
'feature'
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
twice
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
subject
.
execute
end
subject
.
execute
end
context
'when HEAD does not change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
nil
)
.
and_return
(
project
.
default_branch
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
once
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
twice
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'master'
).
once
subject
.
execute
end
end
end
context
'with inmemory feature enabled'
do
before
do
stub_feature_flags
(
find_remote_root_refs_inmemory:
true
)
end
context
'when HEAD change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
'feature'
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
subject
.
execute
end
subject
.
execute
end
context
'when HEAD does not change'
do
...
...
lib/gitlab/gitaly_client/remote_service.rb
View file @
cf786e63
...
...
@@ -45,18 +45,9 @@ module Gitlab
# The remote_name parameter is deprecated and will be removed soon.
def
find_remote_root_ref
(
remote_name
,
remote_url
,
authorization
)
request
=
if
Feature
.
enabled?
(
:find_remote_root_refs_inmemory
,
default_enabled: :yaml
)
Gitaly
::
FindRemoteRootRefRequest
.
new
(
repository:
@gitaly_repo
,
remote_url:
remote_url
,
http_authorization_header:
authorization
)
else
Gitaly
::
FindRemoteRootRefRequest
.
new
(
repository:
@gitaly_repo
,
remote:
remote_name
)
end
request
=
Gitaly
::
FindRemoteRootRefRequest
.
new
(
repository:
@gitaly_repo
,
remote_url:
remote_url
,
http_authorization_header:
authorization
)
response
=
GitalyClient
.
call
(
@storage
,
:remote_service
,
:find_remote_root_ref
,
request
,
timeout:
GitalyClient
.
medium_timeout
)
...
...
spec/lib/gitlab/gitaly_client/remote_service_spec.rb
View file @
cf786e63
...
...
@@ -38,47 +38,26 @@ RSpec.describe Gitlab::GitalyClient::RemoteService do
let
(
:remote
)
{
'origin'
}
let
(
:url
)
{
'http://git.example.com/my-repo.git'
}
let
(
:auth
)
{
'Basic secret'
}
let
(
:expected_params
)
{
{
remote_url:
url
,
http_authorization_header:
auth
}
}
shared_examples
'a find_remote_root_ref call'
do
it
'sends an find_remote_root_ref message and returns the root ref'
do
expect_any_instance_of
(
Gitaly
::
RemoteService
::
Stub
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
with
(
gitaly_request_with_params
(
expected_params
),
kind_of
(
Hash
))
.
and_return
(
double
(
ref:
'master'
))
expect
(
client
.
find_remote_root_ref
(
remote
,
url
,
auth
)).
to
eq
'master'
end
it
'ensure ref is a valid UTF-8 string'
do
expect_any_instance_of
(
Gitaly
::
RemoteService
::
Stub
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
with
(
gitaly_request_with_params
(
expected_params
),
kind_of
(
Hash
))
.
and_return
(
double
(
ref:
"an_invalid_ref_
\xE5
"
))
expect
(
client
.
find_remote_root_ref
(
remote
,
url
,
auth
)).
to
eq
"an_invalid_ref_å"
end
end
context
'with inmemory feature enabled'
do
before
do
stub_feature_flags
(
find_remote_root_refs_inmemory:
true
)
end
it
'sends an find_remote_root_ref message and returns the root ref'
do
expect_any_instance_of
(
Gitaly
::
RemoteService
::
Stub
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
with
(
gitaly_request_with_params
(
expected_params
),
kind_of
(
Hash
))
.
and_return
(
double
(
ref:
'master'
))
it_behaves_like
'a find_remote_root_ref call'
do
let
(
:expected_params
)
{
{
remote_url:
url
,
http_authorization_header:
auth
}
}
end
expect
(
client
.
find_remote_root_ref
(
remote
,
url
,
auth
)).
to
eq
'master'
end
context
'with inmemory feature disabled'
do
before
do
stub_feature_flags
(
find_remote_root_refs_inmemory:
false
)
end
it
'ensure ref is a valid UTF-8 string'
do
expect_any_instance_of
(
Gitaly
::
RemoteService
::
Stub
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
with
(
gitaly_request_with_params
(
expected_params
),
kind_of
(
Hash
))
.
and_return
(
double
(
ref:
"an_invalid_ref_
\xE5
"
))
it_behaves_like
'a find_remote_root_ref call'
do
let
(
:expected_params
)
{
{
remote:
remote
}
}
end
expect
(
client
.
find_remote_root_ref
(
remote
,
url
,
auth
)).
to
eq
"an_invalid_ref_å"
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