Commit 28e324ae authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use Gitlab-Workhorse-Send-Data to send entry:

Closes #19224, Closes #19128

Also requires this MR to work:
https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/53
parent 1a36493d
...@@ -23,8 +23,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -23,8 +23,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
entry = build.artifacts_metadata_entry(params[:path]) entry = build.artifacts_metadata_entry(params[:path])
if entry.exists? if entry.exists?
render json: { archive: build.artifacts_file.path, send_artifacts_entry(build, entry)
entry: Base64.encode64(entry.path) }
else else
render json: {}, status: 404 render json: {}, status: 404
end end
......
...@@ -21,4 +21,10 @@ module WorkhorseHelper ...@@ -21,4 +21,10 @@ module WorkhorseHelper
headers.store(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format)) headers.store(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format))
head :ok head :ok
end end
# Send an entry from artifacts through Workhorse
def send_artifacts_entry(build, entry)
headers.store(*Gitlab::Workhorse.send_artifacts_entry(build, entry))
head :ok
end
end end
...@@ -65,6 +65,18 @@ module Gitlab ...@@ -65,6 +65,18 @@ module Gitlab
] ]
end end
def send_artifacts_entry(build, entry)
params = {
'Archive' => build.artifacts_file.path,
'Entry' => Base64.encode64(entry.path)
}
[
SEND_DATA_HEADER,
"artifacts-entry:#{encode(params)}"
]
end
protected protected
def encode(hash) def encode(hash)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment