diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-09-12 22:20:12 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-09-12 22:20:12 +0800 |
commit | 985252126de7f98c021f3138a720969696440687 (patch) | |
tree | 1ecc571076a1ff274339e40f7be5bd9dca098e49 /app/models/ci/build.rb | |
parent | 5de54a7137ee6de121e5c3477b4901a183b01762 (diff) | |
parent | 12d4eea4c7a46ad3641f2c3a8ee182a16e4848e5 (diff) | |
download | gitlab-ce-985252126de7f98c021f3138a720969696440687.tar.gz |
Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (671 commits)
Only check :can_resolve permission if the note is resolvable
Use Search::GlobalService.new in the `GET /projects/search/:query` endpoint
Improve PipelinesFinder spec so that it does not depend on hard-coded database IDs
Add changelogs/unreleased/.gitkeep
Archive CHANGELOG entries prior to 8.0 in changelogs/archive.md
Request only the LDAP attributes we need
Add notification_settings API calls Use NotificationSetting::EMAIL_EVENTS for params
Pull import sources from Gitlab::ImportSources
Fix API issues sorting
Use gitlab-workhorse 0.8.1
Update CHANGELOG
Avoid conflict with admin labels when importing GitHub labels
Search should compare only the lowercase versions of the project names
Enable pipeline events by default
Minor update on CI docs examples
Move write_note into SlashCommandsHelper and update other dependent specs
Wait for logout message in login_helpers
Use wait_for_ajax to avoid database deadlocks after specs are cleaned
Fix spec failures with spec/features/issues/user_uses_slash_commands_spec.rb
Require comments must be included before code
...
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 755edadb7a4..0bc005af75e 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -211,22 +211,31 @@ module Ci end end + def has_trace_file? + File.exist?(path_to_trace) || has_old_trace_file? + end + def has_trace? raw_trace.present? end def raw_trace - if File.file?(path_to_trace) - File.read(path_to_trace) - elsif project.ci_id && File.file?(old_path_to_trace) - # Temporary fix for build trace data integrity - File.read(old_path_to_trace) + if File.exist?(trace_file_path) + File.read(trace_file_path) else # backward compatibility read_attribute :trace end end + ## + # Deprecated + # + # This is a hotfix for CI build data integrity, see #4246 + def has_old_trace_file? + project.ci_id && File.exist?(old_path_to_trace) + end + def trace trace = raw_trace if project && trace.present? && project.runners_token.present? @@ -265,6 +274,14 @@ module Ci end end + def trace_file_path + if has_old_trace_file? + old_path_to_trace + else + path_to_trace + end + end + def dir_to_trace File.join( Settings.gitlab_ci.builds_path, @@ -355,7 +372,7 @@ module Ci end def artifacts? - !artifacts_expired? && artifacts_file.exists? + !artifacts_expired? && self[:artifacts_file].present? end def artifacts_metadata? |