Existing project moved to a sub group loses reference to its repository
Summary
Version 8.16.7 (EE) In our development (playground) environment, we created a group and assigned a parent id to it so it became a subgroup. Transferring a project to it seems to make it think the repository doesn't exist anymore. We noticed the files went to the group's folder, as it's supposed to, but the new "subgroup" is still in the git-data/repositories directory instead of git-data/repositories/parentgroup directory as it's looking for. Moving the files over didn't change the error.
Steps to reproduce
Run the following in gitlab-rails console:
Groups::UpdateService.new(@SUBGROUP, User.find_by(name: 'ADMIN_ACCOUNT'), parent_id: IDNUMBER).execute
SUBGROUP: The group we want as a "sub group", grabbed from Group.find_by() ADMIN_ACCOUNT: The name of the account that would have access to do this IDNUMBER: The id number of the group we want to be the parent
Then go to a project in the parent's group. Go to the settings and do a "transfer project" to the subgroup.
What is the current bug behavior?
Going to the project (After it's been transfered) gives an error message the repository doesn't eixst.
What is the expected correct behavior?
The project's repository should exist.
Relevant logs and/or screenshots
The project's @path_with_namespace
gets updated to: "parentgroupname/subgroupname/project" and when we do a .repository.path
, we get the directory it's expecting:
/var/opt/gitlab/git-data/repositories/parentgroupname/subgroupname/project.git
However, when we transfered the project, the repository actually to the following location:
/var/opt/gitlab/git-data/repositories/subgroupname/project.git
Results of GitLab environment info
Cannot run sudo commands (do not have permissions for root access on our servers). Can provide if it's 100% necessary to troubleshoot this. omnibus install
Results of GitLab application Check
Cannot run sudo commands (do not have permissions for root access on our servers). Can provide if it's 100% necessary to troubleshoot this. omnibus install
Possible fixes
Not sure where, but perhaps there's a refresh method on the repository object we should be calling after setting the parent_id? Or after we transfer the project? I tried @project.reload
but it didn't change anything.
For reference, see https://gitlab.com/gitlab-org/gitlab-ce/issues/2772#note_25817636