Commit 32b750fe authored by Shinya Maeda's avatar Shinya Maeda

Send raw trace from ObjectStorage

parent 32fbe618
class Projects::JobsController < Projects::ApplicationController
include SendFileUpload
before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!,
......@@ -117,11 +119,24 @@ class Projects::JobsController < Projects::ApplicationController
end
def raw
build.trace.read do |stream|
if stream.file?
send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline'
else
render_404
if trace_artifact
send_upload(trace_artifact.file,
send_params:
{
type: 'text/plain; charset=utf-8',
disposition: 'inline'
},
redirect_params:
{
query: { "response-content-disposition" => "inline" }
} )
else
build.trace.read do |stream|
if stream.file?
send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline'
else
render_404
end
end
end
end
......@@ -144,4 +159,8 @@ class Projects::JobsController < Projects::ApplicationController
def build_path(build)
project_job_path(build.project, build)
end
def trace_artifact
build.job_artifacts_trace
end
end
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