Commit f9f24931 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'pb-use-jobs-finder-on-resolver' into 'master'

Change order jobs are returned from jobs_resolver

See merge request gitlab-org/gitlab!76227
parents 52c20945 e2256451
......@@ -29,7 +29,7 @@ module Resolvers
job_types: security_report_types
).execute
else
pipeline.statuses
pipeline.statuses_order_id_desc
end
end
end
......
......@@ -18,7 +18,7 @@ module Resolvers
def preloads
{
jobs: { statuses: [:needs] },
jobs: { statuses_order_id_desc: [:needs] },
upstream: [:triggered_by_pipeline],
downstream: [:triggered_pipelines]
}
......
......@@ -63,6 +63,7 @@ module Ci
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :latest_statuses_ordered_by_stage, -> { latest.order(:stage_idx, :stage) }, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :latest_statuses, -> { latest }, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :statuses_order_id_desc, -> { order_id_desc }, class_name: 'CommitStatus', foreign_key: :commit_id
has_many :processables, class_name: 'Ci::Processable', foreign_key: :commit_id, inverse_of: :pipeline
has_many :bridges, class_name: 'Ci::Bridge', foreign_key: :commit_id, inverse_of: :pipeline
has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline
......
......@@ -224,6 +224,7 @@ ci_pipelines:
- ci_ref
- stages
- statuses
- statuses_order_id_desc
- latest_statuses_ordered_by_stage
- builds
- bridges
......
......@@ -28,6 +28,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
it { is_expected.to have_many(:trigger_requests) }
it { is_expected.to have_many(:variables) }
it { is_expected.to have_many(:builds) }
it { is_expected.to have_many(:statuses_order_id_desc) }
it { is_expected.to have_many(:bridges) }
it { is_expected.to have_many(:job_artifacts).through(:builds) }
it { is_expected.to have_many(:auto_canceled_pipelines) }
......
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