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
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-01-25 17:46:00 +0300
committerShinya Maeda <shinya@gitlab.com>2018-02-06 09:50:07 +0300
commit1d983024db59ab9791c9a8705e71f20cd9346893 (patch)
tree9f55c1203c94a289906d2898ec3ae3a832ce097e /lib/gitlab/ci
parent0d960fac9115c765896450daf625752f5e9db185 (diff)
Move default_path to legacy_default_path. Switch to the new path for live-trace
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/trace.rb38
1 files changed, 28 insertions, 10 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index d7d4b02b516..aff60467bb1 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -1,3 +1,11 @@
+##
+# Current status of paths
+# Era 1: Live/Full traces in database (ci_builds.trace)
+# Era 2: Live/Full traces in `setting_root/YYYY_MM/project_ci_id/job_id.log`
+# Era 3: Live/Full traces in `setting_root/YYYY_MM/project_id/job_id.log`
+# Era 4: Live traces in `setting_root/live_trace/job_id.log`. Full traces in JobArtifactUploader#legacy_default_path.
+#
+# The legacy paths are to be migrated to the latest era.
module Gitlab
module Ci
class Trace
@@ -99,12 +107,12 @@ module Gitlab
return current_path if current_path
ensure_directory
- default_path
+ live_trace_default_path
end
def ensure_directory
- unless Dir.exist?(default_directory)
- FileUtils.mkdir_p(default_directory)
+ unless Dir.exist?(live_trace_default_directory)
+ FileUtils.mkdir_p(live_trace_default_directory)
end
end
@@ -115,24 +123,34 @@ module Gitlab
end
##
- # This doesn't include the latest path JobArtifactUploader#default_path.
+ # This method doesn't include the latest path, which is JobArtifactUploader#default_path,
+ # Because, in EE, traces can be moved to ObjectStorage, so checking paths in Filestorage doesn't make sense.
+ # All legacy paths (`legacy_default_path` and `deprecated_path`) are to be migrated to JobArtifactUploader#default_path
def paths
[
- default_path,
+ live_trace_default_path,
+ legacy_default_path,
deprecated_path
].compact
end
- def default_directory
+ def live_trace_default_directory
File.join(
Settings.gitlab_ci.builds_path,
- job.created_at.utc.strftime("%Y_%m"),
- job.project_id.to_s
+ 'live_trace'
)
end
- def default_path
- File.join(default_directory, "#{job.id}.log")
+ def live_trace_default_path
+ File.join(live_trace_default_directory, "#{job.id}.log")
+ end
+
+ def legacy_default_path
+ File.join(
+ Settings.gitlab_ci.builds_path,
+ job.created_at.utc.strftime("%Y_%m"),
+ job.project_id.to_s,
+ "#{job.id}.log")
end
def deprecated_path