summaryrefslogtreecommitdiff
path: root/app/models/ci/job_artifact.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-07-18 16:22:46 +0700
committerShinya Maeda <shinya@gitlab.com>2019-07-23 17:26:08 +0700
commitc2e0e689f355555db231ac6db40ab1b654c90233 (patch)
tree1ab8b2e6561598a61a10a0197a975019ed13f464 /app/models/ci/job_artifact.rb
parent1a3fda63a5f9756cde19bc7e221651b0c33cb5dc (diff)
downloadgitlab-ce-c2e0e689f355555db231ac6db40ab1b654c90233.tar.gz
Validate the existence of archived traces before removing live tracesafe-archiving-for-traces
Often live traces are removed even though the archived trace doesn't exist. This commit checkes the existence strictly.
Diffstat (limited to 'app/models/ci/job_artifact.rb')
-rw-r--r--app/models/ci/job_artifact.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index f80e98e5bca..e132cb045e2 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -176,6 +176,10 @@ module Ci
end
end
+ def self.archived_trace_exists_for?(job_id)
+ where(job_id: job_id).trace.take&.file&.file&.exists?
+ end
+
private
def file_format_adapter_class