Trying to open CI/CD settings on `gitlab` project fails with 500

Summary

Originally discussed in slack, we can no longer access the CI/CD settings in the gitlab project, but some other projects work fine. @mbobin and @jivanvl tracked it down to a commit in !52051 (merged), they believe.

Steps to reproduce

Copying @mbobin's reproduction details from: !53061 (merged), (reverting the change but not verified in production yet):

https://sentry.gitlab.net/gitlab/gitlabcom/issues/2471848/?query=is%3Aunresolved%20url%3Ahttps%3A%2F%2Fgitlab.com%2Fgitlab-org%2Fgitlab%2F-%2Fsettings%2Fci_cd

This merge request broke the /-/settings/ci_cd page when there are Pipeline subscriptions defined with projects that are owned by groups: https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#trigger-a-pipeline-when-an-upstream-project-is-rebuilt

  • Create namespace A and B, each with it's own project: C and D
  • Go to /A/C/-/settings/ci_cd
  • Expand Pipeline subscriptions
  • Add B/D as a subscription and press the subscribe button.
  • undefined method 'blocked?' for #<Group id:192> error should appear.

Example Project

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

The problem is in ee/app/views/projects/settings/subscriptions/_project.html.haml#L6 where we call user_avatar_without_link(user: project.owner, size: 32), because project.owner can be a group, not only a user.

image

In this example, templates is a group. I think we should replace user_avatar_without_link with a version of group_icon when project.owner is a group:

diff --git a/ee/app/views/projects/settings/subscriptions/_project.html.haml b/ee/app/views/projects/settings/subscriptions/_project.html.haml
index e8e450d8930..01c74b89d27 100644
--- a/ee/app/views/projects/settings/subscriptions/_project.html.haml
+++ b/ee/app/views/projects/settings/subscriptions/_project.html.haml
@@ -3,7 +3,7 @@
   %td
     = project.name
   %td
-    = user_avatar_without_link(user: project.owner, size: 32)
+    = group_icon(project.owner)
     = project.owner.name
   %td.gl-text-right
     = link_to project_subscription_path(@project, subscription.id), method: :delete, data: { toggle: 'tooltip', title: tooltip, container: 'body', testid: 'delete-subscription' }, class: "gl-button btn btn-danger" do

image

Edited by Marius Bobin