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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/models/ci/bridge.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/models/ci/bridge.rb')
-rw-r--r--app/models/ci/bridge.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb
index d6051d70503..662fb3cffa8 100644
--- a/app/models/ci/bridge.rb
+++ b/app/models/ci/bridge.rb
@@ -18,8 +18,11 @@ module Ci
belongs_to :project
belongs_to :trigger_request
+
+ # To be removed upon :ci_bridge_remove_sourced_pipelines feature flag removal
has_many :sourced_pipelines, class_name: "::Ci::Sources::Pipeline",
- foreign_key: :source_job_id
+ foreign_key: :source_job_id,
+ inverse_of: :source_bridge
has_one :downstream_pipeline, through: :sourced_pipeline, source: :pipeline
@@ -86,8 +89,20 @@ module Ci
end
end
+ def sourced_pipelines
+ if Feature.enabled?(:ci_bridge_remove_sourced_pipelines, project)
+ raise 'Ci::Bridge does not have sourced_pipelines association'
+ end
+
+ super
+ end
+
def has_downstream_pipeline?
- sourced_pipelines.exists?
+ if Feature.enabled?(:ci_bridge_remove_sourced_pipelines, project)
+ sourced_pipeline.present?
+ else
+ sourced_pipelines.exists?
+ end
end
def downstream_pipeline_params