API project import override_params are not all acknowledged
Summary
When trying to import a project file export (export.tar.gz) to a different GitLab instance (or gitlab.com) using the import/export API
in a python wrapper, the override_params
are not all acknowledged e.g.
{'builds_access_level': u'disabled', 'snippets_access_level': u'disabled', 'repository_access_level': u'disabled', 'shared_runners_enabled': True, 'description': u'Test Title', 'wiki_access_level': u'enabled', 'merge_requests_access_level': u'disabled', 'issues_access_level': u'disabled'}
In this case only description
is accepted and overwritten.
Steps to reproduce
curl:
curl --request POST --header "PRIVATE-TOKEN: X" --form "path=test-2" --form "file=@export.tar.gz" --form "override_params[snippets_access_level]=disabled" https://gitlab.com/api/v4/projects/import
Example Project
The issue has been discovered and replicated for migrations from 11.11 (self-managed) -> gitlab.com (12.1.6), but also for 12.1.4 -> 12.1.4 (both self-managed instances).
What is the current bug behavior?
When importing a GitLab project export (.tar.gz
file) either using curl
or a wrapper (e.g. Python) with override_params
only some of the parameters actually overwrite the export as described here.
For instance description
, archived
, visibility
will overwrite the values in the export whereas others issues_access_level
, builds_access_level
will not.
What is the expected correct behavior?
I would expect the import POST request to overwrite all the exported file parameters listed in the override_params
dictionary upon importing to another GitLab instance.
Relevant logs and/or screenshots
Python wrapper override_params
:
{'builds_access_level': u'disabled', 'snippets_access_level': u'disabled', 'repository_access_level': u'disabled', 'shared_runners_enabled': True, 'description': u'', 'wiki_access_level': u'enabled', 'merge_requests_access_level': u'disabled', 'issues_access_level': u'disabled'}
and requests.post
response:
{"id":119,"description":null,"name":"Test-Template","name_with_namespace":"WaveJam Inc / templates / Test-Template","path":"Test-Template","path_with_namespace":"wavejam-inc/templates/Test-Template","created_at":"2019-08-21T15:35:13.902Z","import_status":"scheduled"}
destination instance production.log
Started POST "/api/v4/projects/import" for 143.176.250.43 at 2019-08-21 15:35:13 +0000
Import job scheduled for wavejam-inc/templates/Test-Template with job ID afda909cc5c38a1605a17637.
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Started GET "/-/metrics" for 127.0.0.1 at 2019-08-21 15:35:14 +0000
Processing by MetricsController#index as HTML
Completed 200 OK in 18ms (Views: 0.5ms | ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Started GET "/api/v4/projects/119/import" for 143.176.250.43 at 2019-08-21 15:35:14 +0000
Cannot obtain an exclusive lease. There must be another instance already in execution.
Updating statistics for project 119
Output of checks
This bug happens on GitLab.com (as well as on self-managed instances).
Results of GitLab environment info
Expand for output related to GitLab environment info
ubuntu@ip-172-31-38-234:~$ sudo gitlab-rake gitlab:env:info System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.21.0 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 12.1.6-ee Revision: d05ee0a9c12 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.7 URL: https://pprokic.tanuki.cloud HTTP Clone URL: https://pprokic.tanuki.cloud/some-group/some-project.git SSH Clone URL: git@pprokic.tanuki.cloud:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 9.3.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
ubuntu@ip-172-31-38-234:~$ sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 9.3.0 ? ... OK (9.3.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 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: ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab App ... Git configured correctly? ... yes 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 Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/7 ... yes 95/87 ... yes 95/88 ... yes 95/89 ... yes 95/90 ... yes 151/119 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.21.0 ? ... yes (2.21.0) Git user has default SSH configuration? ... yes Active users: ... 13 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled) Checking GitLab App ... Finished Checking GitLab subtasks ... Finished