summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-28 15:28:39 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-28 15:28:39 +0100
commit42592201d9ce57817d439c5899b63776872a4175 (patch)
tree70efb2c80a1d83729014c16a6d8b82342f13a357
parent19054ba32bc22aec98cd1892bf6ce11fed5ae03f (diff)
downloadgitlab-ce-42592201d9ce57817d439c5899b63776872a4175.tar.gz
Hotfix for builds trace data integrity
Issue #4246
-rw-r--r--app/models/ci/build.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 7b89fe069ea..e251b1dcd97 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -194,8 +194,11 @@ module Ci
end
def raw_trace
- if File.exist?(path_to_trace)
+ if File.file?(path_to_trace)
File.read(path_to_trace)
+ elsif File.file?(old_path_to_trace)
+ # Temporary fix for build trace data integrity
+ File.read(old_path_to_trace)
else
# backward compatibility
read_attribute :trace
@@ -231,6 +234,24 @@ module Ci
"#{dir_to_trace}/#{id}.log"
end
+ ##
+ # Deprecated
+ #
+ def old_dir_to_trace
+ File.join(
+ Settings.gitlab_ci.builds_path,
+ created_at.utc.strftime("%Y_%m"),
+ project.ci_id.to_s
+ )
+ end
+
+ ##
+ # Deprecated
+ #
+ def old_path_to_trace
+ "#{old_dir_to_trace}/#{id}.log"
+ end
+
def token
project.runners_token
end