diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-01-25 12:50:56 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-02-06 09:50:07 +0300 |
commit | 63a9d582aa88d774af5eff124b693df6271ae7bc (patch) | |
tree | 626d1569a1a5a980473abad552832608b6cf56fc /lib/gitlab/ci | |
parent | 84bda43a3c0ce13a436748d0bc0ea943f6ebccb3 (diff) |
Trace as artifacts
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r-- | lib/gitlab/ci/trace.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index baf55b1fa07..a6827d7a38a 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -52,12 +52,14 @@ module Gitlab end def exist? - current_path.present? || old_trace.present? + trace_artifact&.exists? || current_path.present? || old_trace.present? end def read stream = Gitlab::Ci::Trace::Stream.new do - if current_path + if trace_artifact + trace_artifact.open + elsif current_path File.open(current_path, "rb") elsif old_trace StringIO.new(old_trace) @@ -104,12 +106,6 @@ module Gitlab end end - def current_path - @current_path ||= paths.find do |trace_path| - File.exist?(trace_path) - end - end - def paths [ default_path, @@ -117,6 +113,12 @@ module Gitlab ].compact end + def current_path + @current_path ||= paths.find do |trace_path| + File.exist?(trace_path) + end + end + def default_directory File.join( Settings.gitlab_ci.builds_path, @@ -137,6 +139,10 @@ module Gitlab "#{job.id}.log" ) if job.project&.ci_id end + + def trace_artifact + job.job_artifacts_trace + end end end end |