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:
-rw-r--r--app/models/concerns/enums/ci/pipeline.rb7
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb2
-rw-r--r--doc/user/workspace/img/Admin_Settings.pngbin252480 -> 76891 bytes
-rw-r--r--lib/gitlab/ci/pipeline/chain/command.rb4
-rw-r--r--spec/lib/banzai/filter/references/commit_reference_filter_spec.rb30
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/command_spec.rb25
6 files changed, 36 insertions, 32 deletions
diff --git a/app/models/concerns/enums/ci/pipeline.rb b/app/models/concerns/enums/ci/pipeline.rb
index c42b046592f..a7069b22f7c 100644
--- a/app/models/concerns/enums/ci/pipeline.rb
+++ b/app/models/concerns/enums/ci/pipeline.rb
@@ -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
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 826e703a443..95d956fb402 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -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
diff --git a/doc/user/workspace/img/Admin_Settings.png b/doc/user/workspace/img/Admin_Settings.png
index c9ee1b03e9d..b0d13f43ccb 100644
--- a/doc/user/workspace/img/Admin_Settings.png
+++ b/doc/user/workspace/img/Admin_Settings.png
Binary files differ
diff --git a/lib/gitlab/ci/pipeline/chain/command.rb b/lib/gitlab/ci/pipeline/chain/command.rb
index 8cc939b1ce6..8a03789cc3e 100644
--- a/lib/gitlab/ci/pipeline/chain/command.rb
+++ b/lib/gitlab/ci/pipeline/chain/command.rb
@@ -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
diff --git a/spec/lib/banzai/filter/references/commit_reference_filter_spec.rb b/spec/lib/banzai/filter/references/commit_reference_filter_spec.rb
index bee8e42d12e..6bcea41a603 100644
--- a/spec/lib/banzai/filter/references/commit_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/references/commit_reference_filter_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
index 900dfec38e2..8568b763b7a 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/command_spec.rb
@@ -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) }