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:
Diffstat (limited to 'app/services/ci/create_downstream_pipeline_service.rb')
-rw-r--r--app/services/ci/create_downstream_pipeline_service.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/ci/create_downstream_pipeline_service.rb b/app/services/ci/create_downstream_pipeline_service.rb
index a65c22e273c..a2e53cbf9b8 100644
--- a/app/services/ci/create_downstream_pipeline_service.rb
+++ b/app/services/ci/create_downstream_pipeline_service.rb
@@ -125,7 +125,9 @@ module Ci
config_checksum(pipeline) unless pipeline.child?
end
- pipeline_checksums.uniq.length != pipeline_checksums.length
+ # 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
@@ -137,7 +139,7 @@ module Ci
end
def config_checksum(pipeline)
- [pipeline.project_id, pipeline.ref].hash
+ [pipeline.project_id, pipeline.ref, pipeline.source].hash
end
end
end