提交 801e4271 编写于 作者: K Kamil Trzciński 提交者: Shinya Maeda

Minimal fix for artifacts service

上级 58a312f5
......@@ -4,13 +4,34 @@ module Ci
return if job.job_artifacts_trace
job.trace.read do |stream|
if stream.file?
return unless stream.file?
temp_file!(JobArtifactUploader.workhorse_upload_path) do |temp_path|
FileUtils.cp(stream.path, temp_path)
create_job_trace!(temp_path)
FileUtils.rm(stream.path)
end
end
end
private
def create_job_trace!(path)
job.create_job_artifacts_trace!(
project: job.project,
file_type: :trace,
file: stream)
end
file: UploadedFile.new(path, 'build.log', 'application/octet-stream')
)
end
def temp_file!(temp_dir)
FileUtils.mkdir_p(temp_dir)
temp_file = Tempfile.new('file', temp_dir)
temp_file&.close
yield(temp_file.path)
ensure
temp_file&.close
temp_file&.unlink
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册