Import / Export is failing
Summary
After exporting from GitLab and importing to my GitLab instance the project fails with Failed to replace pipelines because one or more of the new records could not be saved
.
Steps to reproduce
- Export https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
- In GitLab 8.11.4 ee import with
GitLab Export
button
Expected behavior
I'd expect the project to be imported.
Actual behaviour
An import failure message with the following content:
Failed to replace pipelines because one or more of the new records could not be saved
Relevant logs and/or screenshots
==> /var/log/gitlab/gitlab-rails/production.log <==
Import/Export error raised on /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:20:in `rescue in restore': Failed to replace pipelines because one or more of the new records could not be saved.
["/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:542:in `replace_records'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:373:in `block in replace'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:183:in `block in transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/transactions.rb:220:in `transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:182:in `transaction'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:373:in `replace'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/collection_association.rb:47:in `writer'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/associations/builder/association.rb:123:in `pipelines='", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/persistence.rb:240:in `update_attribute'", "/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:1495:in `append_or_update_attribute'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:50:in `block in create_relations'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:43:in `each'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:43:in `create_relations'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:17:in `block in restore'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/no_touching.rb:29:in `apply_to'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/no_touching.rb:22:in `no_touching'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/project_tree_restorer.rb:16:in `restore'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/importer.rb:12:in `each'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/importer.rb:12:in `all?'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/importer.rb:12:in `execute'", "/opt/gitlab/embedded/service/gitlab-rails/app/services/projects/import_service.rb:56:in `import_data'", "/opt/gitlab/embedded/service/gitlab-rails/app/services/projects/import_service.rb:19:in `execute'", "/opt/gitlab/embedded/service/gitlab-rails/app/workers/repository_import_worker.rb:19:in `perform'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:152:in `execute_job'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:134:in `block (2 levels) in process'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/request_store_middleware.rb:6:in `call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'", "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/memory_killer.rb:17:in `call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/server/active_record.rb:6:in `call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/logging.rb:32:in `with_context'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/server/logging.rb:7:in `call'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/middleware/chain.rb:133:in `invoke'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:129:in `block in process'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:168:in `stats'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:128:in `process'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:80:in `process_one'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/processor.rb:68:in `run'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/util.rb:17:in `watchdog'", "/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.1.4/lib/sidekiq/util.rb:25:in `block in safe_thread'"]
Output of checks
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 3.4.0 ? ... OK (3.4.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... no
User id for git: 998. Groupd id for git: 998
Try fixing it:
sudo chown -R git:git /var/opt/gitlab/git-data/repositories
For more information see:
doc/install/installation.md in section "GitLab Shell"
Please fix the error above and rerun the checks.
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
1/1 ... ok
1/3 ... repository is empty
1/4 ... repository is empty
1/5 ... ok
1/6 ... repository is empty
1/8 ... repository is empty
3/9 ... ok
1/10 ... repository is empty
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... skipped (no tmp uploads folder yet)
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: ...
1/1 ... yes
1/3 ... yes
1/4 ... yes
1/5 ... yes
1/6 ... yes
1/8 ... yes
3/9 ... yes
1/10 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 2
Checking GitLab ... Finished
Results of GitLab environment info
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.6.6
Bundler Version:2.3.0
Rake Version: 10.5.0
Sidekiq Version:4.1.4
GitLab information
Version: 8.11.3-ee
Revision: bb4a9e0
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 9.2.18
URL: https://primate.githost.io
HTTP Clone URL: https://primate.githost.io/some-group/some-project.git
SSH Clone URL: git@primate.githost.io:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: gitlab
GitLab Shell
Version: 3.4.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
/cc @DouweM