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

Send raw trace from ObjectStorage

parent 32fbe618
class Projects::JobsController < Projects::ApplicationController class Projects::JobsController < Projects::ApplicationController
include SendFileUpload
before_action :build, except: [:index, :cancel_all] before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!, before_action :authorize_read_build!,
...@@ -117,6 +119,18 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -117,6 +119,18 @@ class Projects::JobsController < Projects::ApplicationController
end end
def raw def raw
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| build.trace.read do |stream|
if stream.file? if stream.file?
send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline' send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline'
...@@ -125,6 +139,7 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -125,6 +139,7 @@ class Projects::JobsController < Projects::ApplicationController
end end
end end
end end
end
private private
...@@ -144,4 +159,8 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -144,4 +159,8 @@ class Projects::JobsController < Projects::ApplicationController
def build_path(build) def build_path(build)
project_job_path(build.project, build) project_job_path(build.project, build)
end end
def trace_artifact
build.job_artifacts_trace
end
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