Custom group-level project templates do not show up on sub-group despite configuration
Summary
After following the process to configure custom group-level templates on a subgroup, the template group does not show up when trying to create a new project with template under the same subgroup.
Ultimate tier Customer support ticket where this was reported (internal link) is: https://gitlab.zendesk.com/agent/tickets/254354
Steps to reproduce
The problem has not been reproducible yet despite attempts on self-managed and on GitLab.com. The following is the situation at the SaaS customer where the problem has been observed:
-
Group
A
(Top level group)- The user is a direct member at this group level
- The user that cannot see the template group is marked as role
Reporter
here
-
Group
A/B
(Sub-group)- The user is a direct member at this sub-group level
- The user is marked as role
Owner
at this sub-group level - This sub-group carries configuration under Settings > General that marks sub-group
A/B/C
as its custom group of project templates
-
Group
A/B/C
(Project templates sub-group)- The user is an inherited member at this sub-group level
- The user is marked as role
Owner
through the permission inheritance - This sub-group carries one project in it that should appear as a template
When the user visits Group A/B
and tries to create a new project under it, selecting the template option shows no visible groups as evidenced in this screenshot:
Example Project
Since we've not been able to reproduce their issue, we do not have one yet.
We have tried simulating the issue however under using my user account setup in the same style of access and hierarchy as above: https://gitlab.com/gitlab-silver/hchouraria (with gitlab-silver/hchouraria
representing A/B
)
What is the current bug behavior?
The configured subgroup carrying the template projects does not show up under the groups tab when creating a new project from template.
What is the expected correct behavior?
The configured subgroup carrying the template projects shows up under the groups tab when creating a new project from template.
Relevant logs and/or screenshots
We tried to check a few things through the console to understand why this was occurring, primarily following the group checking implementation found here: https://gitlab.com/gitlab-org/gitlab/blob/716818037a4da55e3ee0eeb5b1c5117a2a8804f6/ee/app/models/ee/user.rb#L227-237
Peculiarly the GroupsWithTemplatesFinder
execution returns no groups found when the group ID of A/B
subgroup is supplied:
GroupsWithTemplatesFinder.new(group_id).execute
=> #<ActiveRecord::Relation []>
Likewise, trying the manual scopes from its implementation too results in no matches when run over the same group ID for A/B
subgroup:
Group.with_project_templates.self_and_ancestors.with_feature_available_in_plan(:group
_project_templates).self_and_descendants.find_by(id: group_id)
=> nil
The customer is on a valid Ultimate/Gold plan and has access to the feature configuration.
Output of checks
This bug happens on GitLab.com
Possible fixes
TBD. We're uncertain currently why the user's lookup of applicable template groups do not find any results.