Custom instance-level project templates do not import protected branches settings
Summary
Protected branches settings like Allowed to push and Allowed to merge are not retained when a new project is created from a custom instance-level project template. See #11775 (closed) where similar behavior is reported for projects created from group-level templates.
Steps to reproduce
- In a project, configure a protected branch so that Developers + Maintainers are Allowed to push to that branch called
dev
- In the same project, configure a protected branch so that No one is Allowed to push to that branch called
feature
- Set that project as a custom instance-level project template
- Create a new project based on that template
- Browse to Settings > Repository, expand Protected branches
- Observe that Allowed to push on the
dev
branch is Maintainers (instead of Developers + Maintainers) - Observe that Allowed to push is no longer set to No one on the
feature
branch
This is observed in GitLab 15.1 and GitLab 15.2.
Example Project
There are no custom instance-level project templates set up for gitlab.com
.
What is the current bug behavior?
The protected branches settings are not retained when a new project is based on a custom instance-level project template.
What is the expected correct behavior?
The protected branches settings should be retained when a new project is based on a custom instance-level project template.
Relevant logs and/or screenshots
The project used as the instance-level template has these protected branches settings:
After creating a new project based on this template, the protected branches settings look like this:
Output of checks
It is not presently possible to test this on gitlab.com
.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 20.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.5p203 Gem Version: 3.1.4 Bundler Version:2.3.15 Rake Version: 13.0.6 Redis Version: 6.2.7 Sidekiq Version:6.4.0 Go Version: unknown GitLab information Version: 15.1.2-ee Revision: 324ae02f89f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 13.6 URL: https://gitlab.example.com HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git SSH Clone URL: git@gitlab.example.com:some-group/some-project.git Elasticsearch: yes Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.7.4 Repository storage paths: - default: /unicorn/defaultnotused/repositories - storage00: /unicorn/storage00/repositories - storage01: /unicorn/storage01/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 14.7.4 ? ... OK (14.7.4) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK storage00 ... OK storage01 ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 9 users of 100 limit.
Checking LDAP ... Finished
Checking GitLab App ...
Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 2/1 ... yes 4/6 ... yes 21/10 ... yes 30/11 ... yes 32/12 ... yes 32/13 ... yes 32/14 ... yes 30/15 ... yes 39/16 ... yes 30/17 ... yes 4/18 ... yes 45/19 ... yes 48/20 ... yes 48/21 ... yes 48/22 ... yes 48/23 ... yes 59/24 ... yes 61/25 ... yes 64/26 ... yes 1/27 ... yes 68/28 ... yes 70/29 ... yes 70/30 ... yes 68/31 ... yes 68/32 ... yes 68/33 ... yes 68/34 ... yes 77/35 ... yes 77/36 ... yes 1/37 ... yes 83/38 ... yes 85/39 ... yes 85/40 ... yes 85/41 ... yes 83/42 ... yes 85/43 ... yes 85/44 ... yes 85/45 ... yes 85/46 ... yes 99/47 ... yes 95/48 ... yes 95/49 ... yes 96/50 ... yes 96/51 ... yes 98/52 ... yes 99/53 ... yes 85/54 ... yes 110/55 ... yes 110/56 ... yes 4/57 ... yes 110/58 ... yes 83/59 ... yes 53/60 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git user has default SSH configuration? ... yes Active users: ... 15 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... yes (elasticsearch 7.17.5)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished