Wiki repository 'exists?' false after GitHub project import
Summary
When importing a particular project from GitHub, the repository/issues/wiki were all successfully imported. Wiki content is there, but trying to edit throws Gitlab::Git:Repository::NoRepository.
Running GitLab CE from the 10.8.3 Omnibus image, on gitlab.freedesktop.org. Object storage not enabled for repositories.
Steps to reproduce
I'm not sure if this can be directly reproduced. The source repository was yuq825/mesa, and without access to his account I cannot import this myself.
- Attempt to import yuq825/mesa into a GitLab project
- Note repository/issue/wiki content all imported correctly and visible
- Attempt to edit existing wiki 'home' page
The project is at freedesktop.org's lima/mesa, and I am happy to be a proxy for a Rails console.
Example Project
N/A. Sorry. :(
What is the current bug behavior?
Error banner: GitLab: A repository for this project does not exist yet.
Poking in the Rails console, I found that wiki.repository.exists? returned false, yet all its pre-conditions were satisfied. Manually calling wiki.repository.expire_exists_cache made this work correctly.
What is the expected correct behavior?
Wiki content can be edited, nonsensical error not thrown.
Relevant logs and/or screenshots
Here's my bashing at the Rails console, with various typos and thinkos elided:
irb(main):004:0> p
=> #<Project id:150 lima/mesa>
irb(main):005:0> p.has_wiki?
=> true
irb(main):007:0> w = p.wiki
=> #<ProjectWiki:0x00007f765b4fa118 @project=#<Project id:150 lima/mesa>, @user=#<Group id:1844 @lima>>
irb(main):008:0> w.repository_exists?
=> false
irb(main):009:0> p.repository_exists?
=> true
irb(main):010:0> p.repository
=> #<Repository:lima/mesa>
irb(main):011:0> w.repository
=> #<Repository:lima/mesa.wiki>
irb(main):012:0> p.full_path
=> "lima/mesa"
irb(main):013:0> w.full_path
=> "lima/mesa.wiki"
irb(main):020:0> w.repository.raw_repository
=> #<Gitlab::Git::Repository:0x00007f766e9729d0 @storage="default", @relative_path="lima/mesa.wiki.git", @gl_repository="wiki-150", @gitlab_projects=#<Gitlab::Git::GitlabProjects:0x00007f766e972930 @shard_name="default", @repository_relative_path="lima/mesa.wiki.git", @logger=#<ActiveSupport::Logger:0x00007f766c8c0ef8 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x00007f766c8c0de0 @datetime_format=nil>, @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007f7673f0c9b8 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x00007f766c8c0cf0 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/opt/gitlab/embedded/service/gitlab-rails/log/production.log>, @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x00007f766c8c0cc8>>, @local_levels=#<ThreadSafe::Cache:0x00007f766c8c0bb0 @backend={}, @default_proc=nil>>, @global_hooks_path="/opt/gitlab/embedded/service/gitlab-shell/hooks", @output=#<StringIO:0x00007f766e972700>>, @name="mesa.wiki.git">
irb(main):021:0> p.repository.raw_repository
=> #<Gitlab::Git::Repository:0x00007f765ab1f968 @storage="default", @relative_path="lima/mesa.git", @gl_repository="project-150", @gitlab_projects=#<Gitlab::Git::GitlabProjects:0x00007f765ab1f918 @shard_name="default", @repository_relative_path="lima/mesa.git", @logger=#<ActiveSupport::Logger:0x00007f766c8c0ef8 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x00007f766c8c0de0 @datetime_format=nil>, @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x00007f7673f0c9b8 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x00007f766c8c0cf0 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/opt/gitlab/embedded/service/gitlab-rails/log/production.log>, @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x00007f766c8c0cc8>>, @local_levels=#<ThreadSafe::Cache:0x00007f766c8c0bb0 @backend={}, @default_proc=nil>>, @global_hooks_path="/opt/gitlab/embedded/service/gitlab-shell/hooks", @output=#<StringIO:0x00007f765ab1f8c8>>, @name="mesa.git">
irb(main):022:0> w.repository.expire_exists_cache
=> [:exists?]
irb(main):023:0> w.repository.exists?
=> true
A selection of logs from the import process follows. I couldn't find any others, but can/will dig on demand.
GitLab logs from repo import
gitlab-rails/production_json.log:{"method":"GET","path":"/import/github/new","format":"html","controller":"Import::GithubController","action":"new","status":200,"duration":96.67,"view":76.09,"db":8.83,"time":"2018-06-05T06:29:31.900Z","params":[],"remote_ip":"127.0.0.1","user_id":1554,"username":"yuq825"}
gitlab-rails/production_json.log:{"method":"GET","path":"/import/github/status","format":"html","controller":"Import::GithubController","action":"status","status":302,"duration":13.12,"view":0.0,"db":1.38,"location":"https://github.com/login/oauth/authorize","time":"2018-06-05T06:30:41.450Z","params":[],"remote_ip":"127.0.0.1","user_id":1554,"username":"yuq825"}
gitlab-rails/production_json.log:{"method":"GET","path":"/import/github/callback","format":"html","controller":"Import::GithubController","action":"callback","status":302,"duration":165.13,"view":0.0,"db":1.43,"location":"https://gitlab.freedesktop.org/import/github/status","time":"2018-06-05T06:31:32.245Z","params":[{"key":"code","value":"[FILTERED]"}],"remote_ip":"127.0.0.1","user_id":1554,"username":"yuq825"}
gitlab-rails/production_json.log:{"method":"GET","path":"/import/github/status","format":"html","controller":"Import::GithubController","action":"status","status":200,"duration":889.19,"view":318.61,"db":36.21,"time":"2018-06-05T06:31:32.924Z","params":[],"remote_ip":"127.0.0.1","user_id":1554,"username":"yuq825"}
gitlab-rails/production_json.log:{"method":"POST","path":"/import/github","format":"json","controller":"Import::GithubController","action":"create","status":200,"duration":609.6,"view":0.44,"db":48.1,"time":"2018-06-05T06:35:00.990Z","params":[{"key":"repo_id","value":"93909976"},{"key":"target_namespace","value":"lima"},{"key":"new_name","value":"mesa"},{"key":"ci_cd_only","value":false},{"key":"github","value":{"repo_id":"93909976","target_namespace":"lima","new_name":"mesa","ci_cd_only":false}}],"remote_ip":"127.0.0.1","user_id":1554,"username":"yuq825","gitaly_calls":3}
sidekiq/current:2018-06-05_06:36:29.05529 2018-06-05T06:36:29.055Z 3987 TID-oup267z0g Gitlab::GithubImport::Stage::FinishImportWorker JID-c21e2a860adaa2b9f437f195 INFO: GitHub importer finished for lima/mesa in 87.61 seconds
gitaly/current:2018-06-05_06:36:09.51810 time="2018-06-05T06:36:09Z" level=info msg="finished unary call" grpc.code=OK grpc.meta.client_name=gitlab-sidekiq grpc.method=RepositoryExists grpc.request.glRepository=wiki-150 grpc.request.repoPath=lima/mesa.wiki.git grpc.request.repoStorage=default grpc.request.topLevelGroup=lima grpc.service=gitaly.RepositoryService grpc.time_ms=0 peer.address=@ span.kind=server system=grpc
gitaly/current:2018-06-05_07:48:15.06502 time="2018-06-05T07:48:15Z" level=info msg="finished unary call" grpc.code=OK grpc.meta.call_site=wiki_update_page grpc.meta.client_name=gitlab-web grpc.method=RepositoryExists grpc.request.glRepository=wiki-150 grpc.request.repoPath=lima/mesa.wiki.git grpc.request.repoStorage=default grpc.request.topLevelGroup=lima grpc.service=gitaly.RepositoryService grpc.time_ms=0 peer.address=@ span.kind=server system=grpc
sidekiq/current:2018-06-05_06:36:27.11075 2018-06-05T06:36:27.110Z 3987 TID-oup267z0g Gitlab::GithubImport::Stage::FinishImportWorker JID-c21e2a860adaa2b9f437f195 INFO: start
sidekiq/current:2018-06-05_06:36:29.05529 2018-06-05T06:36:29.055Z 3987 TID-oup267z0g Gitlab::GithubImport::Stage::FinishImportWorker JID-c21e2a860adaa2b9f437f195 INFO: GitHub importer finished for lima/mesa in 87.61 seconds
sidekiq/current:2018-06-05_06:36:29.10694 2018-06-05T06:36:29.106Z 3987 TID-oup267z0g Gitlab::GithubImport::Stage::FinishImportWorker JID-c21e2a860adaa2b9f437f195 INFO: done: 1.996 sec
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.3.7p456 Gem Version: 2.6.14 Bundler Version:1.13.7 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.16.4 Sidekiq Version:5.0.5 Go Version: unknownGitLab information Version: 10.8.3 Revision: 564c342 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.freedesktop.org HTTP Clone URL: https://gitlab.freedesktop.org/some-group/some-project.git SSH Clone URL: git@gitlab.freedesktop.org:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2, gitlab, github, twitter
GitLab Shell Version: 7.1.2 Repository storage paths:
- default: /gitlab-data/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 1222/1 ... repository is empty 1222/2 ... ok 1222/3 ... ok 1222/4 ... ok 1332/5 ... ok 1345/6 ... ok 1345/7 ... ok 1345/10 ... ok 1345/11 ... ok 255/14 ... ok 255/15 ... ok 255/16 ... ok 1348/17 ... ok 1345/18 ... ok 1345/19 ... ok 1020/20 ... ok 1020/21 ... ok 1020/23 ... ok 1099/24 ... ok 1308/25 ... ok 1336/26 ... ok 255/27 ... repository is empty 255/28 ... ok 1099/30 ... ok 255/31 ... ok 1357/32 ... ok 1349/34 ... repository is empty 1200/35 ... ok 123/36 ... ok 1150/37 ... ok 1150/38 ... ok 1305/40 ... ok 736/41 ... ok 1385/42 ... ok 1098/43 ... ok 123/44 ... ok 1098/45 ... ok 1033/46 ... ok 1353/47 ... ok 1403/48 ... ok 1099/49 ... ok 1098/51 ... ok 1124/52 ... ok 1152/53 ... repository is empty 1305/54 ... ok 1305/55 ... ok 1305/56 ... ok 1290/57 ... ok 1199/58 ... ok 1406/59 ... ok 1199/60 ... ok 1199/61 ... ok 1199/62 ... ok 1199/63 ... ok 1199/64 ... ok 1199/65 ... ok 1199/66 ... ok 1199/67 ... ok 1199/68 ... ok 1199/69 ... repository is empty 1199/70 ... ok 1199/71 ... repository is empty 1199/72 ... ok 1199/73 ... ok 1407/74 ... ok 1407/75 ... ok 1407/76 ... ok 1407/77 ... ok 1407/78 ... ok 1407/79 ... ok 1/80 ... ok 1093/81 ... ok 1093/82 ... ok 1093/83 ... ok 1093/84 ... ok 326/85 ... ok 326/86 ... ok 1430/87 ... ok 1430/88 ... ok 1430/89 ... ok 1056/90 ... ok 1056/91 ... ok 1372/92 ... ok 1372/93 ... ok 1372/94 ... ok 1372/95 ... ok 1372/96 ... ok 1440/97 ... ok 768/99 ... ok 1028/100 ... ok 1347/101 ... ok 280/102 ... ok 1453/103 ... ok 1500/104 ... ok 1155/105 ... ok 1020/106 ... ok 972/107 ... ok 1035/110 ... ok 1035/111 ... ok 972/113 ... ok 1345/114 ... ok 903/115 ... ok 1054/116 ... ok 1694/117 ... ok 1293/118 ... ok 1293/119 ... repository is empty 1158/120 ... ok 1158/121 ... ok 1724/122 ... repository is empty 1188/123 ... ok 1188/124 ... ok 1042/125 ... ok 1710/126 ... ok 1155/127 ... ok 1743/128 ... ok 123/129 ... ok 1188/131 ... ok 1/132 ... ok 1113/133 ... ok 1788/134 ... ok 1/135 ... ok 1158/136 ... ok 1/137 ... ok 1/138 ... ok 1217/139 ... ok 818/140 ... ok 1724/141 ... repository is empty 1724/142 ... repository is empty 1155/143 ... ok 1155/144 ... ok 1155/145 ... ok 1155/146 ... ok 1723/147 ... ok 1844/148 ... ok 1844/149 ... ok 1844/150 ... ok 1034/151 ... ok 1844/152 ... repository is empty 686/153 ... ok 686/154 ... ok 1/155 ... ok 1418/156 ... ok 1418/157 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /gitlab-data/ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
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: ... 1222/1 ... yes 1222/2 ... yes 1222/3 ... yes 1222/4 ... yes 1332/5 ... yes 1345/6 ... yes 1345/7 ... yes 1345/10 ... yes 1345/11 ... yes 255/14 ... yes 255/15 ... yes 255/16 ... yes 1348/17 ... yes 1345/18 ... yes 1345/19 ... yes 1020/20 ... yes 1020/21 ... yes 1020/23 ... yes 1099/24 ... yes 1308/25 ... yes 1336/26 ... yes 255/27 ... yes 255/28 ... yes 1099/30 ... yes 255/31 ... yes 1357/32 ... yes 1349/34 ... yes 1200/35 ... yes 123/36 ... yes 1150/37 ... yes 1150/38 ... yes 1305/40 ... yes 736/41 ... yes 1385/42 ... yes 1098/43 ... yes 123/44 ... yes 1098/45 ... yes 1033/46 ... yes 1353/47 ... yes 1403/48 ... yes 1099/49 ... yes 1098/51 ... yes 1124/52 ... yes 1152/53 ... yes 1305/54 ... yes 1305/55 ... yes 1305/56 ... yes 1290/57 ... yes 1199/58 ... yes 1406/59 ... yes 1199/60 ... yes 1199/61 ... yes 1199/62 ... yes 1199/63 ... yes 1199/64 ... yes 1199/65 ... yes 1199/66 ... yes 1199/67 ... yes 1199/68 ... yes 1199/69 ... yes 1199/70 ... yes 1199/71 ... yes 1199/72 ... yes 1199/73 ... yes 1407/74 ... yes 1407/75 ... yes 1407/76 ... yes 1407/77 ... yes 1407/78 ... yes 1407/79 ... yes 1/80 ... yes 1093/81 ... yes 1093/82 ... yes 1093/83 ... yes 1093/84 ... yes 326/85 ... yes 326/86 ... yes 1430/87 ... yes 1430/88 ... yes 1430/89 ... yes 1056/90 ... yes 1056/91 ... yes 1372/92 ... yes 1372/93 ... yes 1372/94 ... yes 1372/95 ... yes 1372/96 ... yes 1440/97 ... yes 768/99 ... yes 1028/100 ... yes 1347/101 ... yes 280/102 ... yes 1453/103 ... yes 1500/104 ... yes 1155/105 ... yes 1020/106 ... yes 972/107 ... yes 1035/110 ... yes 1035/111 ... yes 972/113 ... yes 1345/114 ... yes 903/115 ... yes 1054/116 ... yes 1694/117 ... yes 1293/118 ... yes 1293/119 ... yes 1158/120 ... yes 1158/121 ... yes 1724/122 ... yes 1188/123 ... yes 1188/124 ... yes 1042/125 ... yes 1710/126 ... yes 1155/127 ... yes 1743/128 ... yes 123/129 ... yes 1188/131 ... yes 1/132 ... yes 1113/133 ... yes 1788/134 ... yes 1/135 ... yes 1158/136 ... yes 1/137 ... yes 1/138 ... yes 1217/139 ... yes 818/140 ... yes 1724/141 ... yes 1724/142 ... yes 1155/143 ... yes 1155/144 ... yes 1155/145 ... yes 1155/146 ... yes 1723/147 ... yes 1844/148 ... yes 1844/149 ... yes 1844/150 ... yes 1034/151 ... yes 1844/152 ... yes 686/153 ... yes 686/154 ... yes 1/155 ... yes 1418/156 ... yes 1418/157 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.7) Git version >= 2.9.5 ? ... yes (2.16.4) Git user has default SSH configuration? ... yes Active users: ... 1344
Checking GitLab ... Finished
Possible fixes
Afraid I have no idea, but I assume your GitHub import is getting excercised pretty thoroughly these days, so maybe this rings a bell for someone.