Commit 00493319 authored by Michał Zając's avatar Michał Zając

Reuse Ci::Pipeline.newest_first method

parent d476de65
...@@ -151,9 +151,8 @@ class Vulnerability < ApplicationRecord ...@@ -151,9 +151,8 @@ class Vulnerability < ApplicationRecord
# See https://gitlab.com/gitlab-org/gitlab/-/issues/218012 # See https://gitlab.com/gitlab-org/gitlab/-/issues/218012
latest_successful_pipeline = project latest_successful_pipeline = project
.ci_pipelines .ci_pipelines
.for_ref(project.default_branch) .newest_first(ref: project.default_branch, limit: 10)
.where(status: :success) .success
.order(created_at: :desc)
.find { |pipeline| pipeline.builds.any? { |build| build.name == self.report_type } } .find { |pipeline| pipeline.builds.any? { |build| build.name == self.report_type } }
# Technically this shouldn't ever happen. # Technically this shouldn't ever happen.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment