Cannot import project, access levels are not blank
We've been trying to import projects from our self-hosted GitLab CE. We just upgraded to gitlab-ce 10.0 to get on the same version of the import/export module. The import went further than ever before, but it failed, too!
The repository could not be imported.
Error importing repository into example/example - Failed to replace protected_branches because one or more of the new records could not be saved. Merge access levels group must be blank Push access levels group must be blank
We use protected branches, but it’s only set on master and the role is “Masters”, which exists on gitlab.com. In fact, we have all of the default project roles.
I opened the project.json
from the export archive and found the following under protected_branches
.
id : 3
project_id : 3
name : master
created_at : 2016-11-16T17:18:35.035Z
updated_at : 2016-11-16T17:18:35.035Z
merge_access_levels : {@{id=3; protected_branch_id=3; access_level=40; created_at=2016-11-16T17:18:35.037Z; updated_at=2016-11-16T17:18:35.037Z}}
push_access_levels : {@{id=3; protected_branch_id=3; access_level=40; created_at=2016-11-16T17:18:35.038Z; updated_at=2016-11-16T17:18:35.038Z}}
This comment indicates that 30 and 40 refer to the builtin roles, Developers and Masters, which exist in my self-hosted GitLab CE and on gitlab.com.
- These migrations still used 0 to mean "Masters" and 1 to mean "Developers" (matching the previous Rails enum), while Gitlab::Access uses 40 and 30 for these, respectively.