API issues closed_by missing merge requests from other projects
Summary
The /api/v4/projects/:id/issues/:iid/closed_by
endpoint is supposed to allow an API user to fetch all merge requests which will result in this issue being closed. However, this endpoint only appears to resolve merge requests in the same project, leaving no way to resolve merge requests which are referenced elsewhere via the API.
Steps to reproduce
- Have a group
AlphaGroup
. - AlphaGroup has two projects
BravoProject
&CharlieProject
. - BravoProject has an issue, issue #
1
. - CharlieProject has a merge request, merge !
2
. This merge request contains the following description:fixes AlphaGroup/BravoProject#1
- BravoProject issue #
1
in the web interface will now correctly update, showing that CharlieProject merge !2
will close this issue. - An API call to
/v4/projects/<bravoProjectId>/issues/1/closed_by
will return an empty array. This should instead return CharlieProject merge !2
.
Example Project
Unfortunately this is in a standalone enterprise instance. However if you're unable to reproduce I can attempt to create gitlab.com projects for the sole purpose of recreation.
What is the current bug behavior?
api/v4/projects/:id/issues/:iid/closed_by
returns an empty array despite there being one or more merge requests which will close that issue in a different project.
What is the expected correct behavior?
api/v4/projects/:id/issues/:iid/closed_by
should return all merge requests that close it, despite the project, just like the web interface does.
Relevant logs and/or screenshots
No relevant logs at this time.
Output of checks
Unsure as to what this is.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 14.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.17.1 Sidekiq Version:5.1.3 Go Version: unknown
GitLab information Version: 11.1.4-ee Revision: d17962f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.8 URL: https://snip HTTP Clone URL: https://snip/some-group/some-project.git SSH Clone URL: ssh://snip/some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: no
GitLab Shell Version: 7.1.4 Repository storage paths:
- default: /data/repos/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
sudo gitlab-rake gitlab:check SANITIZE=true Checking GitLab Shell ...
GitLab Shell version >= 7.1.4 ? ... OK (7.1.4) 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: ... 5/5 ... ok 5/7 ... ok 12/13 ... ok 2/14 ... ok 2/15 ... ok 12/16 ... ok 2/17 ... ok 27/18 ... ok 17/20 ... ok 14/23 ... ok 28/26 ... ok 28/27 ... ok 28/28 ... ok 28/29 ... ok 28/30 ... ok 28/31 ... ok 28/32 ... ok 28/33 ... ok 28/34 ... ok 28/35 ... ok 28/36 ... ok 28/37 ... ok 28/38 ... ok 18/39 ... ok 28/40 ... ok 28/41 ... ok 28/42 ... ok 15/43 ... ok 29/44 ... ok 21/46 ... ok 20/47 ... ok 5/48 ... ok 5/49 ... ok 5/50 ... ok 5/51 ... ok 5/52 ... ok 5/53 ... ok 5/54 ... ok 5/55 ... ok 5/56 ... ok 5/57 ... ok 5/58 ... ok 5/59 ... ok 5/60 ... ok 5/61 ... ok 5/62 ... ok 5/63 ... ok 5/64 ... ok 5/65 ... ok 5/66 ... ok 5/67 ... ok 5/68 ... ok 5/69 ... ok 5/70 ... ok 5/71 ... ok 5/72 ... ok 22/75 ... ok 5/76 ... ok 5/77 ... ok 5/78 ... ok 24/79 ... ok 5/80 ... ok 22/81 ... repository is empty 20/82 ... ok 26/83 ... repository is empty 37/84 ... ok 37/85 ... ok 5/86 ... repository is empty 22/87 ... ok 19/88 ... ok 19/89 ... ok 21/90 ... ok 16/91 ... ok 21/92 ... ok 23/93 ... ok 32/94 ... ok 32/95 ... ok 28/96 ... ok 26/98 ... repository is empty 26/99 ... ok 23/100 ... repository is empty 12/101 ... ok 23/102 ... ok 16/104 ... ok 17/105 ... ok 17/106 ... ok 17/107 ... ok 15/109 ... ok 16/110 ... repository is empty 20/111 ... ok 15/112 ... ok 19/113 ... ok 19/114 ... ok 5/115 ... ok 19/118 ... repository is empty 14/119 ... ok 29/121 ... ok 29/122 ... ok 22/123 ... ok 21/126 ... ok 23/127 ... ok 25/128 ... ok 20/129 ... ok 15/130 ... ok 5/131 ... ok 32/134 ... ok 19/135 ... ok 42/136 ... ok 44/137 ... ok 12/138 ... ok 47/140 ... ok 12/145 ... ok 49/148 ... ok 49/149 ... ok 49/150 ... ok 19/153 ... ok 12/154 ... ok 32/155 ... ok 17/156 ... ok 22/157 ... ok 29/158 ... ok 53/159 ... ok 53/160 ... ok 20/161 ... ok 26/162 ... ok 16/163 ... ok 22/164 ... ok 5/165 ... ok 12/166 ... ok 19/167 ... ok 22/168 ... ok 20/169 ... ok 21/170 ... ok 33/171 ... ok 57/172 ... ok 57/173 ... ok 32/174 ... ok 58/175 ... ok 58/176 ... ok 58/177 ... ok 58/178 ... ok 58/179 ... ok 32/180 ... ok 32/182 ... ok 59/183 ... ok 59/184 ... ok 42/185 ... ok 59/186 ... ok 58/187 ... ok 60/188 ... ok 60/189 ... ok 57/190 ... ok 21/191 ... ok 61/192 ... ok 62/193 ... ok 62/194 ... ok 22/195 ... ok 21/196 ... ok 63/197 ... ok 63/198 ... ok 64/199 ... ok 57/200 ... ok 64/201 ... ok 53/202 ... ok 63/203 ... ok 61/204 ... ok 5/205 ... ok 66/206 ... ok 30/207 ... ok 64/208 ... ok 52/209 ... ok 5/210 ... ok 23/211 ... ok 63/212 ... ok 69/213 ... ok 69/214 ... ok 69/215 ... ok 69/216 ... ok 60/217 ... ok 70/218 ... ok 70/219 ... ok 67/220 ... ok 70/221 ... ok 26/222 ... ok 57/223 ... ok 12/224 ... ok 25/225 ... ok 22/226 ... ok 70/227 ... ok 5/228 ... ok 5/229 ... ok 69/230 ... ok 5/231 ... ok 22/232 ... ok 76/234 ... ok 76/235 ... ok 22/236 ... ok 12/239 ... ok 76/240 ... ok 21/241 ... ok 22/242 ... ok 76/243 ... ok 69/244 ... ok 88/245 ... ok 88/246 ... ok 88/247 ... ok 21/248 ... ok 23/249 ... ok 42/250 ... ok 76/251 ... ok 91/252 ... ok 91/253 ... ok 91/254 ... ok 57/255 ... ok 93/256 ... ok 5/257 ... ok 12/258 ... ok 5/259 ... ok 57/260 ... ok 93/261 ... ok 5/262 ... ok 57/263 ... ok 22/264 ... ok 5/265 ... ok 59/267 ... ok 5/268 ... ok 59/269 ... ok 69/270 ... ok 5/271 ... ok 14/272 ... ok 5/273 ... ok 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 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: ... 5/5 ... yes 5/7 ... yes 12/13 ... yes 2/14 ... yes 2/15 ... yes 12/16 ... yes 2/17 ... yes 27/18 ... yes 17/20 ... yes 14/23 ... yes 28/26 ... yes 28/27 ... yes 28/28 ... yes 28/29 ... yes 28/30 ... yes 28/31 ... yes 28/32 ... yes 28/33 ... yes 28/34 ... yes 28/35 ... yes 28/36 ... yes 28/37 ... yes 28/38 ... yes 18/39 ... yes 28/40 ... yes 28/41 ... yes 28/42 ... yes 15/43 ... yes 29/44 ... yes 21/46 ... yes 20/47 ... yes 5/48 ... yes 5/49 ... yes 5/50 ... yes 5/51 ... yes 5/52 ... yes 5/53 ... yes 5/54 ... yes 5/55 ... yes 5/56 ... yes 5/57 ... yes 5/58 ... yes 5/59 ... yes 5/60 ... yes 5/61 ... yes 5/62 ... yes 5/63 ... yes 5/64 ... yes 5/65 ... yes 5/66 ... yes 5/67 ... yes 5/68 ... yes 5/69 ... yes 5/70 ... yes 5/71 ... yes 5/72 ... yes 22/75 ... yes 5/76 ... yes 5/77 ... yes 5/78 ... yes 24/79 ... yes 5/80 ... yes 22/81 ... yes 20/82 ... yes 26/83 ... yes 37/84 ... yes 37/85 ... yes 5/86 ... yes 22/87 ... yes 19/88 ... yes 19/89 ... yes 21/90 ... yes 16/91 ... yes 21/92 ... yes 23/93 ... yes 32/94 ... yes 32/95 ... yes 28/96 ... yes 26/98 ... yes 26/99 ... yes 23/100 ... yes 12/101 ... yes 23/102 ... yes 16/104 ... yes 17/105 ... yes 17/106 ... yes 17/107 ... yes 15/109 ... yes 16/110 ... yes 20/111 ... yes 15/112 ... yes 19/113 ... yes 19/114 ... yes 5/115 ... yes 19/118 ... yes 14/119 ... yes 29/121 ... yes 29/122 ... yes 22/123 ... yes 21/126 ... yes 23/127 ... yes 25/128 ... yes 20/129 ... yes 15/130 ... yes 5/131 ... yes 32/134 ... yes 19/135 ... yes 42/136 ... yes 44/137 ... yes 12/138 ... yes 47/140 ... yes 12/145 ... yes 49/148 ... yes 49/149 ... yes 49/150 ... yes 19/153 ... yes 12/154 ... yes 32/155 ... yes 17/156 ... yes 22/157 ... yes 29/158 ... yes 53/159 ... yes 53/160 ... yes 20/161 ... yes 26/162 ... yes 16/163 ... yes 22/164 ... yes 5/165 ... yes 12/166 ... yes 19/167 ... yes 22/168 ... yes 20/169 ... yes 21/170 ... yes 33/171 ... yes 57/172 ... yes 57/173 ... yes 32/174 ... yes 58/175 ... yes 58/176 ... yes 58/177 ... yes 58/178 ... yes 58/179 ... yes 32/180 ... yes 32/182 ... yes 59/183 ... yes 59/184 ... yes 42/185 ... yes 59/186 ... yes 58/187 ... yes 60/188 ... yes 60/189 ... yes 57/190 ... yes 21/191 ... yes 61/192 ... yes 62/193 ... yes 62/194 ... yes 22/195 ... yes 21/196 ... yes 63/197 ... yes 63/198 ... yes 64/199 ... yes 57/200 ... yes 64/201 ... yes 53/202 ... yes 63/203 ... yes 61/204 ... yes 5/205 ... yes 66/206 ... yes 30/207 ... yes 64/208 ... yes 52/209 ... yes 5/210 ... yes 23/211 ... yes 63/212 ... yes 69/213 ... yes 69/214 ... yes 69/215 ... yes 69/216 ... yes 60/217 ... yes 70/218 ... yes 70/219 ... yes 67/220 ... yes 70/221 ... yes 26/222 ... yes 57/223 ... yes 12/224 ... yes 25/225 ... yes 22/226 ... yes 70/227 ... yes 5/228 ... yes 5/229 ... yes 69/230 ... yes 5/231 ... yes 22/232 ... yes 76/234 ... yes 76/235 ... yes 22/236 ... yes 12/239 ... yes 76/240 ... yes 21/241 ... yes 22/242 ... yes 76/243 ... yes 69/244 ... yes 88/245 ... yes 88/246 ... yes 88/247 ... yes 21/248 ... yes 23/249 ... yes 42/250 ... yes 76/251 ... yes 91/252 ... yes 91/253 ... yes 91/254 ... yes 57/255 ... yes 93/256 ... yes 5/257 ... yes 12/258 ... yes 5/259 ... yes 57/260 ... yes 93/261 ... yes 5/262 ... yes 57/263 ... yes 22/264 ... yes 5/265 ... yes 59/267 ... yes 5/268 ... yes 59/269 ... yes 69/270 ... yes 5/271 ... yes 14/272 ... yes 5/273 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.17.1) Git user has default SSH configuration? ... yes Active users: ... -snip- Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
Possible fixes
I believe the line in question is here, given that the projectId is being passed into the query may be the cause, but I am unfamiliar with the gitlab codebase.