summaryrefslogtreecommitdiff
path: root/app/models/ci/ref.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/ref.rb')
-rw-r--r--app/models/ci/ref.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/ci/ref.rb b/app/models/ci/ref.rb
index 6e9b8416c10..713a0bf9c45 100644
--- a/app/models/ci/ref.rb
+++ b/app/models/ci/ref.rb
@@ -33,6 +33,9 @@ module Ci
state :still_failing, value: 5
after_transition any => [:fixed, :success] do |ci_ref|
+ # Do not try to unlock if no artifacts are locked
+ next unless ci_ref.artifacts_locked?
+
ci_ref.run_after_commit do
Ci::PipelineSuccessUnlockArtifactsWorker.perform_async(ci_ref.last_finished_pipeline_id)
end
@@ -54,6 +57,10 @@ module Ci
Ci::Pipeline.last_finished_for_ref_id(self.id)&.id
end
+ def artifacts_locked?
+ self.pipelines.where(locked: :artifacts_locked).exists?
+ end
+
def update_status_by!(pipeline)
retry_lock(self) do
next unless last_finished_pipeline_id == pipeline.id