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/policies/ci/bridge_policy.rb')
-rw-r--r--app/policies/ci/bridge_policy.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/policies/ci/bridge_policy.rb b/app/policies/ci/bridge_policy.rb
index 5f9e8eab08a..9cf3a017b39 100644
--- a/app/policies/ci/bridge_policy.rb
+++ b/app/policies/ci/bridge_policy.rb
@@ -5,8 +5,12 @@ module Ci
include Ci::DeployablePolicy
condition(:can_update_downstream_branch) do
- ::Gitlab::UserAccess.new(@user, container: @subject.downstream_project)
- .can_update_branch?(@subject.target_revision_ref)
+ # `bridge.downstream_project` could be `nil` if the downstream project was removed after the pipeline creation,
+ # which raises an error in `UserAccess` class because `container` arg must be present.
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/424145 for more information.
+ @subject.downstream_project.present? &&
+ ::Gitlab::UserAccess.new(@user, container: @subject.downstream_project)
+ .can_update_branch?(@subject.target_revision_ref)
end
rule { can_update_downstream_branch }.enable :play_job