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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
94b209b3
Commit
94b209b3
authored
May 16, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move git archives downloading to Gitaly
parent
73289a83
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
23 deletions
+9
-23
changelogs/unreleased/zj-workhorse-archive-mandatory.yml
changelogs/unreleased/zj-workhorse-archive-mandatory.yml
+5
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+1
-6
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+0
-4
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+1
-11
No files found.
changelogs/unreleased/zj-workhorse-archive-mandatory.yml
0 → 100644
View file @
94b209b3
---
title
:
Workhorse will use Gitaly to create archives
merge_request
:
author
:
type
:
other
lib/gitlab/git/repository.rb
View file @
94b209b3
...
@@ -403,10 +403,10 @@ module Gitlab
...
@@ -403,10 +403,10 @@ module Gitlab
prefix
=
archive_prefix
(
ref
,
commit
.
id
,
append_sha:
append_sha
)
prefix
=
archive_prefix
(
ref
,
commit
.
id
,
append_sha:
append_sha
)
{
{
'RepoPath'
=>
path
,
'ArchivePrefix'
=>
prefix
,
'ArchivePrefix'
=>
prefix
,
'ArchivePath'
=>
archive_file_path
(
storage_path
,
commit
.
id
,
prefix
,
format
),
'ArchivePath'
=>
archive_file_path
(
storage_path
,
commit
.
id
,
prefix
,
format
),
'CommitId'
=>
commit
.
id
'CommitId'
=>
commit
.
id
,
'GitalyRepository'
=>
gitaly_repository
.
to_h
}
}
end
end
...
...
lib/gitlab/workhorse.rb
View file @
94b209b3
...
@@ -65,12 +65,7 @@ module Gitlab
...
@@ -65,12 +65,7 @@ module Gitlab
params
=
repository
.
archive_metadata
(
ref
,
Gitlab
.
config
.
gitlab
.
repository_downloads_path
,
format
,
append_sha:
append_sha
)
params
=
repository
.
archive_metadata
(
ref
,
Gitlab
.
config
.
gitlab
.
repository_downloads_path
,
format
,
append_sha:
append_sha
)
raise
"Repository or ref not found"
if
params
.
empty?
raise
"Repository or ref not found"
if
params
.
empty?
if
Gitlab
::
GitalyClient
.
feature_enabled?
(
:workhorse_archive
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
params
[
'GitalyServer'
]
=
gitaly_server_hash
(
repository
)
params
.
merge!
(
'GitalyServer'
=>
gitaly_server_hash
(
repository
),
'GitalyRepository'
=>
repository
.
gitaly_repository
.
to_h
)
end
# If present DisableCache must be a Boolean. Otherwise workhorse ignores it.
# If present DisableCache must be a Boolean. Otherwise workhorse ignores it.
params
[
'DisableCache'
]
=
true
if
git_archive_cache_disabled?
params
[
'DisableCache'
]
=
true
if
git_archive_cache_disabled?
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
94b209b3
...
@@ -249,10 +249,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -249,10 +249,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
subject
(
:metadata
)
{
repository
.
archive_metadata
(
ref
,
storage_path
,
format
,
append_sha:
append_sha
)
}
subject
(
:metadata
)
{
repository
.
archive_metadata
(
ref
,
storage_path
,
format
,
append_sha:
append_sha
)
}
it
'sets RepoPath to the repository path'
do
expect
(
metadata
[
'RepoPath'
]).
to
eq
(
repository
.
path
)
end
it
'sets CommitId to the commit SHA'
do
it
'sets CommitId to the commit SHA'
do
expect
(
metadata
[
'CommitId'
]).
to
eq
(
SeedRepo
::
LastCommit
::
ID
)
expect
(
metadata
[
'CommitId'
]).
to
eq
(
SeedRepo
::
LastCommit
::
ID
)
end
end
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
94b209b3
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Workhorse
do
describe
Gitlab
::
Workhorse
do
l
et
(
:project
)
{
create
(
:project
,
:repository
)
}
s
et
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
def
decode_workhorse_header
(
array
)
def
decode_workhorse_header
(
array
)
...
@@ -55,16 +55,6 @@ describe Gitlab::Workhorse do
...
@@ -55,16 +55,6 @@ describe Gitlab::Workhorse do
end
end
end
end
context
'when Gitaly workhorse_archive feature is disabled'
,
:disable_gitaly
do
it
'sets the header correctly'
do
key
,
command
,
params
=
decode_workhorse_header
(
subject
)
expect
(
key
).
to
eq
(
'Gitlab-Workhorse-Send-Data'
)
expect
(
command
).
to
eq
(
'git-archive'
)
expect
(
params
).
to
eq
(
base_params
)
end
end
context
"when the repository doesn't have an archive file path"
do
context
"when the repository doesn't have an archive file path"
do
before
do
before
do
allow
(
project
.
repository
).
to
receive
(
:archive_metadata
).
and_return
(
Hash
.
new
)
allow
(
project
.
repository
).
to
receive
(
:archive_metadata
).
and_return
(
Hash
.
new
)
...
...
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