summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-01-26 02:21:31 +0900
committerShinya Maeda <shinya@gitlab.com>2018-02-06 15:50:08 +0900
commit002f314f320c5731681297225fff5b528de88ed2 (patch)
treebc897fd5d1daff9e7a12815151b1a929266db074
parentb9692501060b3543bd3289bd806920044516db8c (diff)
downloadgitlab-ce-002f314f320c5731681297225fff5b528de88ed2.tar.gz
Expose current_path
-rw-r--r--app/uploaders/job_artifact_uploader.rb8
-rw-r--r--lib/gitlab/ci/trace.rb12
2 files changed, 11 insertions, 9 deletions
diff --git a/app/uploaders/job_artifact_uploader.rb b/app/uploaders/job_artifact_uploader.rb
index 841168438d8..4c814c6f501 100644
--- a/app/uploaders/job_artifact_uploader.rb
+++ b/app/uploaders/job_artifact_uploader.rb
@@ -14,9 +14,11 @@ class JobArtifactUploader < GitlabUploader
end
def open
- raise 'Only File System is supported' unless file_storage?
-
- File.open(path) if path
+ if file_storage?
+ File.open(path, "rb")
+ else
+ raise 'Only File System is supported'
+ end
end
private
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb
index 27f5869770e..307e3bf1c8f 100644
--- a/lib/gitlab/ci/trace.rb
+++ b/lib/gitlab/ci/trace.rb
@@ -101,6 +101,12 @@ module Gitlab
job.erase_old_trace!
end
+ def current_path
+ @current_path ||= paths.find do |trace_path|
+ File.exist?(trace_path)
+ end
+ end
+
private
def ensure_path
@@ -116,12 +122,6 @@ module Gitlab
end
end
- def current_path
- @current_path ||= paths.find do |trace_path|
- File.exist?(trace_path)
- end
- end
-
##
# 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.