Commit 91c0ec04 authored by David Fernandez's avatar David Fernandez

Merge branch 'remove-flag-and-block-cyclical-pipelines' into 'master'

Block execution of cyclical pipelines

See merge request gitlab-org/gitlab!81287
parents 569bd89b 12f9e6db
...@@ -120,15 +120,13 @@ module Ci ...@@ -120,15 +120,13 @@ module Ci
def has_cyclic_dependency? def has_cyclic_dependency?
return false if @bridge.triggers_child_pipeline? return false if @bridge.triggers_child_pipeline?
if Feature.enabled?(:ci_drop_cyclical_triggered_pipelines, @bridge.project, default_enabled: :yaml) pipeline_checksums = @bridge.pipeline.self_and_upstreams.filter_map do |pipeline|
pipeline_checksums = @bridge.pipeline.self_and_upstreams.filter_map do |pipeline| config_checksum(pipeline) unless pipeline.child?
config_checksum(pipeline) unless pipeline.child?
end
# To avoid false positives we allow 1 cycle in the ancestry and
# fail when 2 cycles are detected: A -> B -> A -> B -> A
pipeline_checksums.tally.any? { |_checksum, occurrences| occurrences > 2 }
end end
# To avoid false positives we allow 1 cycle in the ancestry and
# fail when 2 cycles are detected: A -> B -> A -> B -> A
pipeline_checksums.tally.any? { |_checksum, occurrences| occurrences > 2 }
end end
def has_max_descendants_depth? def has_max_descendants_depth?
......
---
name: ci_drop_cyclical_triggered_pipelines
introduced_by_url: https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/1195
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/329390
milestone: '13.12'
type: development
group: group::pipeline execution
default_enabled: false
...@@ -485,14 +485,6 @@ RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do ...@@ -485,14 +485,6 @@ RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do
end end
it_behaves_like 'detects cyclical pipelines' it_behaves_like 'detects cyclical pipelines'
context 'when ci_drop_cyclical_triggered_pipelines is not enabled' do
before do
stub_feature_flags(ci_drop_cyclical_triggered_pipelines: false)
end
it_behaves_like 'passes cyclical pipeline precondition'
end
end end
context 'when source in the ancestry differ' do context 'when source in the ancestry differ' do
......
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