diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/services/ci/create_downstream_pipeline_service.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/services/ci/create_downstream_pipeline_service.rb')
-rw-r--r-- | app/services/ci/create_downstream_pipeline_service.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/ci/create_downstream_pipeline_service.rb b/app/services/ci/create_downstream_pipeline_service.rb index 93f0338fcba..64a99e404c6 100644 --- a/app/services/ci/create_downstream_pipeline_service.rb +++ b/app/services/ci/create_downstream_pipeline_service.rb @@ -85,6 +85,12 @@ module Ci return false end + if has_cyclic_dependency? + @bridge.drop!(:pipeline_loop_detected) + + return false + end + true end @@ -109,11 +115,24 @@ module Ci end end + def has_cyclic_dependency? + return false if @bridge.triggers_child_pipeline? + + if Feature.enabled?(:ci_drop_cyclical_triggered_pipelines, @bridge.project, default_enabled: :yaml) + checksums = @bridge.pipeline.base_and_ancestors.map { |pipeline| config_checksum(pipeline) } + checksums.uniq.length != checksums.length + end + end + def has_max_descendants_depth? return false unless @bridge.triggers_child_pipeline? ancestors_of_new_child = @bridge.pipeline.base_and_ancestors(same_project: true) ancestors_of_new_child.count > MAX_DESCENDANTS_DEPTH end + + def config_checksum(pipeline) + [pipeline.project_id, pipeline.ref].hash + end end end |