Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
f50df1c9ff
commit
2691cff829
|
@ -37,7 +37,8 @@ module Enums
|
|||
merge_request_event: 10,
|
||||
external_pull_request_event: 11,
|
||||
parent_pipeline: 12,
|
||||
ondemand_dast_scan: 13
|
||||
ondemand_dast_scan: 13,
|
||||
ondemand_dast_validation: 14
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -48,8 +49,10 @@ module Enums
|
|||
# parent pipeline. It's up to the parent to affect the ref CI status
|
||||
# - when an ondemand_dast_scan pipeline runs it is for testing purpose and should
|
||||
# not affect the ref CI status.
|
||||
# - when an ondemand_dast_validation pipeline runs it is for validating a DAST site
|
||||
# profile and should not affect the ref CI status.
|
||||
def self.dangling_sources
|
||||
sources.slice(:webide, :parent_pipeline, :ondemand_dast_scan)
|
||||
sources.slice(:webide, :parent_pipeline, :ondemand_dast_scan, :ondemand_dast_validation)
|
||||
end
|
||||
|
||||
# CI sources are those pipeline events that affect the CI status of the ref
|
||||
|
|
|
@ -149,7 +149,7 @@ class Gitlab::Seeder::CycleAnalytics
|
|||
email: "vsm-user-#{i}@#{suffix}.com"
|
||||
)
|
||||
|
||||
project.group.add_developer(user)
|
||||
project.group&.add_developer(user)
|
||||
project.add_developer(user)
|
||||
|
||||
@developers << user
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 75 KiB |
|
@ -106,10 +106,6 @@ module Gitlab
|
|||
metrics.pipeline_failure_reason_counter
|
||||
.increment(reason: (reason || :unknown_failure).to_s)
|
||||
end
|
||||
|
||||
def dangling_build?
|
||||
%i[ondemand_dast_scan webide].include?(source)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -269,4 +269,34 @@ RSpec.describe Banzai::Filter::References::CommitReferenceFilter do
|
|||
expect(reference_filter(act, context).css('a').first.text).to eql("#{project.full_path}@#{commit.short_id}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'checking N+1' do
|
||||
let(:namespace2) { create(:namespace) }
|
||||
let(:namespace3) { create(:namespace) }
|
||||
let(:project2) { create(:project, :public, :repository, namespace: namespace2) }
|
||||
let(:project3) { create(:project, :public, :repository, namespace: namespace3) }
|
||||
let(:commit2) { project2.commit }
|
||||
let(:commit3) { project3.commit }
|
||||
let(:commit_reference) { commit.to_reference }
|
||||
let(:commit2_reference) { commit2.to_reference(full: true) }
|
||||
let(:commit3_reference) { commit3.to_reference(full: true) }
|
||||
|
||||
it 'does not have N+1 per multiple references per project', :use_sql_query_cache do
|
||||
markdown = "#{commit_reference}"
|
||||
max_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
|
||||
reference_filter(markdown)
|
||||
end.count
|
||||
|
||||
markdown = "#{commit_reference} 8b95f2f1 8b95f2f2 8b95f2f3 #{commit2_reference} #{commit3_reference}"
|
||||
|
||||
# Commits are not DB entries, they are on the project itself.
|
||||
# So adding commits from two more projects to the markdown should
|
||||
# only increase by 1 query
|
||||
max_count += 1
|
||||
|
||||
expect do
|
||||
reference_filter(markdown)
|
||||
end.not_to exceed_all_query_limit(max_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -271,31 +271,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Command do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#dangling_build?' do
|
||||
let(:project) { create(:project, :repository) }
|
||||
let(:command) { described_class.new(project: project, source: source) }
|
||||
|
||||
subject { command.dangling_build? }
|
||||
|
||||
context 'when source is :webide' do
|
||||
let(:source) { :webide }
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'when source is :ondemand_dast_scan' do
|
||||
let(:source) { :ondemand_dast_scan }
|
||||
|
||||
it { is_expected.to eq(true) }
|
||||
end
|
||||
|
||||
context 'when source something else' do
|
||||
let(:source) { :web }
|
||||
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#creates_child_pipeline?' do
|
||||
let(:command) { described_class.new(bridge: bridge) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue