diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /app/policies/ci/bridge_policy.rb | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'app/policies/ci/bridge_policy.rb')
-rw-r--r-- | app/policies/ci/bridge_policy.rb | 8 |
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 |