Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-02-26 17:06:04 +0300
committerShinya Maeda <shinya@gitlab.com>2018-03-06 15:43:19 +0300
commit32c1501d69d1618452e0088b343a6806769d79a9 (patch)
tree470240815db1a615ec65996cb38e0e423dae7f34 /app
parentf0d7a2ffc419e5e4893f9161c008d4ead5d3a660 (diff)
Add rake task. Adopt the latest fix. Drop CreateTraceArtifactService
Diffstat (limited to 'app')
-rw-r--r--app/services/ci/create_trace_artifact_service.rb36
-rw-r--r--app/workers/archive_legacy_trace_worker.rb10
-rw-r--r--app/workers/create_trace_artifact_worker.rb4
3 files changed, 11 insertions, 39 deletions
diff --git a/app/services/ci/create_trace_artifact_service.rb b/app/services/ci/create_trace_artifact_service.rb
deleted file mode 100644
index ffde824972c..00000000000
--- a/app/services/ci/create_trace_artifact_service.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-module Ci
- class CreateTraceArtifactService < BaseService
- def execute(job)
- return if job.job_artifacts_trace
-
- job.trace.read do |stream|
- break unless stream.file?
-
- clone_file!(stream.path, JobArtifactUploader.workhorse_upload_path) do |clone_path|
- create_job_trace!(job, clone_path)
- FileUtils.rm(stream.path)
- end
- end
- end
-
- private
-
- def create_job_trace!(job, path)
- File.open(path) do |stream|
- job.create_job_artifacts_trace!(
- project: job.project,
- file_type: :trace,
- file: stream)
- end
- end
-
- def clone_file!(src_path, temp_dir)
- FileUtils.mkdir_p(temp_dir)
- Dir.mktmpdir('tmp-trace', temp_dir) do |dir_path|
- temp_path = File.join(dir_path, "job.log")
- FileUtils.copy(src_path, temp_path)
- yield(temp_path)
- end
- end
- end
-end
diff --git a/app/workers/archive_legacy_trace_worker.rb b/app/workers/archive_legacy_trace_worker.rb
new file mode 100644
index 00000000000..01b6224494b
--- /dev/null
+++ b/app/workers/archive_legacy_trace_worker.rb
@@ -0,0 +1,10 @@
+class ArchiveLegacyTraceWorker
+ include ApplicationWorker
+ include ObjectStorageQueue
+
+ def perform(job_id)
+ Ci::Build.find_by(id: job_id).try do |job|
+ job.trace.archive!
+ end
+ end
+end
diff --git a/app/workers/create_trace_artifact_worker.rb b/app/workers/create_trace_artifact_worker.rb
index 3283e8d79f0..a0cec43157e 100644
--- a/app/workers/create_trace_artifact_worker.rb
+++ b/app/workers/create_trace_artifact_worker.rb
@@ -2,10 +2,8 @@ class CreateTraceArtifactWorker
include ApplicationWorker
include PipelineQueue
- # TODO: this worker should use BackgroundMigration or ObjectStorage queue
-
def perform(job_id)
- Ci::Build.preload(:project, :user).find_by(id: job_id).try do |job|
+ Ci::Build.find_by(id: job_id).try do |job|
job.trace.archive!
end
end