BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
27732df3
Commit
27732df3
authored
Jan 11, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'option-disable-archive-cache' into 'master'
Add option to disable git archive caching in workhorse See merge request gitlab-org/gitlab-ce!16325
parents
a188030d
d805cd36
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
GITLAB_WORKHORSE_VERSION
GITLAB_WORKHORSE_VERSION
+1
-1
workhorse.rb
lib/gitlab/workhorse.rb
+7
-0
workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+14
-0
No files found.
GITLAB_WORKHORSE_VERSION
View file @
27732df3
3.
4
.0
3.
5
.0
lib/gitlab/workhorse.rb
View file @
27732df3
...
...
@@ -97,6 +97,9 @@ module Gitlab
)
end
# If present DisableCache must be a Boolean. Otherwise workhorse ignores it.
params
[
'DisableCache'
]
=
true
if
git_archive_cache_disabled?
[
SEND_DATA_HEADER
,
"git-archive:
#{
encode
(
params
)
}
"
...
...
@@ -244,6 +247,10 @@ module Gitlab
right_commit_id:
diff_refs
.
head_sha
}
end
def
git_archive_cache_disabled?
ENV
[
'WORKHORSE_ARCHIVE_CACHE_DISABLED'
].
present?
||
Feature
.
enabled?
(
:workhorse_archive_cache_disabled
)
end
end
end
end
spec/lib/gitlab/workhorse_spec.rb
View file @
27732df3
...
...
@@ -26,11 +26,16 @@ describe Gitlab::Workhorse do
'GitalyRepository'
=>
repository
.
gitaly_repository
.
to_h
.
deep_stringify_keys
)
end
let
(
:cache_disabled
)
{
false
}
subject
do
described_class
.
send_git_archive
(
repository
,
ref:
ref
,
format:
format
)
end
before
do
allow
(
described_class
).
to
receive
(
:git_archive_cache_disabled?
).
and_return
(
cache_disabled
)
end
context
'when Gitaly workhorse_archive feature is enabled'
do
it
'sets the header correctly'
do
key
,
command
,
params
=
decode_workhorse_header
(
subject
)
...
...
@@ -39,6 +44,15 @@ describe Gitlab::Workhorse do
expect
(
command
).
to
eq
(
'git-archive'
)
expect
(
params
).
to
include
(
gitaly_params
)
end
context
'when archive caching is disabled'
do
let
(
:cache_disabled
)
{
true
}
it
'tells workhorse not to use the cache'
do
_
,
_
,
params
=
decode_workhorse_header
(
subject
)
expect
(
params
).
to
include
({
'DisableCache'
=>
true
})
end
end
end
context
'when Gitaly workhorse_archive feature is disabled'
,
:skip_gitaly_mock
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