Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/persistent_ref.rb')
-rw-r--r--app/models/ci/persistent_ref.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ci/persistent_ref.rb b/app/models/ci/persistent_ref.rb
index 57aa1962bd2..f713d5952bc 100644
--- a/app/models/ci/persistent_ref.rb
+++ b/app/models/ci/persistent_ref.rb
@@ -19,6 +19,11 @@ module Ci
false
end
+ # This needs to be kept in sync with `Ci::Pipeline#after_transition` calling `pipeline.persistent_ref.delete`
+ def should_delete?
+ pipeline.status.to_sym.in?(::Ci::Pipeline.stopped_statuses)
+ end
+
def create
create_ref(sha, path)
rescue StandardError => e
@@ -27,6 +32,8 @@ module Ci
end
def delete
+ return unless should_delete?
+
delete_refs(path)
rescue Gitlab::Git::Repository::NoRepository
# no-op