Retrying a job via API does not work for Developer users
Summary
According to the GitLab documentation, users with Developer access to a project should be able to cancel and retry jobs. However, when attempting to retry a job via the API, GitLab returns 403 Forbidden
for Developer users. If one gives the user Maintainer permissions to the project, then the API call succeeds.
Steps to reproduce
-
Start with a project that has an associated build already created.
-
Create a user and give it Developer permissions to the project.
-
Attempt to retry the build using the API, e.g.
curl --header "PRIVATE-TOKEN: <token>" https://gitlab.host.com/api/v4/projects/186/jobs/33949/retry
-
Notice that the API call fails with a
403 Forbidden
error.
What is the current bug behavior?
The API call fails.
What is the expected correct behavior?
The API call succeeds and the job is retried, per the documentation.
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.5.3p105 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknownGitLab information Version: 11.9.6 Revision: 14bac95 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.host.com HTTP Clone URL: https://gitlab.host.com/some-group/some-project.git SSH Clone URL: git@gitlab.host.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.7.1 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
Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 8.7.1 ? ... OK (8.7.1) 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: ... 3/1 ... yes 3/2 ... yes 12/3 ... yes 3/4 ... yes 13/5 ... yes 13/6 ... yes 13/7 ... yes 2/8 ... yes 3/16 ... yes 13/17 ... yes 13/18 ... yes 8/19 ... yes 3/20 ... yes 7/21 ... yes 4/22 ... yes 7/23 ... yes 2/24 ... yes 3/25 ... yes 3/26 ... yes 3/27 ... yes 3/28 ... yes 3/29 ... yes 13/30 ... yes 3/32 ... yes 4/33 ... yes 3/34 ... yes 4/35 ... yes 4/36 ... yes 4/37 ... yes 3/38 ... yes 3/39 ... yes 3/40 ... yes 3/44 ... yes 3/46 ... yes 3/47 ... yes 3/48 ... yes 3/50 ... yes 2/51 ... yes 3/54 ... yes 2/55 ... yes 3/56 ... yes 2/57 ... yes 3/59 ... yes 3/60 ... yes 3/62 ... yes 3/63 ... yes 3/65 ... yes 3/66 ... yes 2/68 ... yes 3/69 ... yes 3/70 ... yes 3/71 ... yes 8/72 ... yes 27/74 ... yes 27/75 ... yes 3/76 ... yes 5/77 ... yes 3/78 ... yes 3/80 ... yes 3/81 ... yes 12/82 ... yes 3/84 ... yes 3/87 ... yes 5/88 ... yes 3/89 ... yes 2/92 ... yes 2/93 ... yes 4/94 ... yes 3/95 ... yes 4/96 ... yes 3/97 ... yes 3/98 ... yes 27/99 ... yes 27/100 ... yes 27/102 ... yes 3/104 ... yes 3/105 ... yes 3/106 ... yes 3/107 ... yes 2/108 ... yes 3/109 ... yes 3/110 ... yes 3/111 ... yes 8/112 ... yes 8/113 ... yes 8/115 ... yes 2/116 ... yes 2/117 ... yes 3/118 ... yes 3/119 ... yes 8/120 ... yes 27/121 ... yes 3/122 ... yes 8/123 ... yes 3/124 ... yes 8/125 ... yes 8/126 ... yes 8/127 ... yes 8/128 ... yes 8/130 ... yes 17/131 ... yes 17/133 ... yes 8/134 ... yes 8/135 ... yes 3/138 ... yes 3/139 ... yes 3/140 ... yes 3/142 ... yes 3/143 ... yes 17/144 ... yes 8/145 ... yes 7/146 ... yes 48/147 ... yes 3/148 ... yes 3/149 ... yes 3/150 ... yes 8/151 ... yes 3/152 ... yes 3/153 ... yes 56/154 ... yes 27/157 ... yes 3/158 ... yes 3/159 ... yes 3/160 ... yes 3/161 ... yes 48/162 ... yes 3/163 ... yes 3/165 ... yes 3/166 ... yes 8/168 ... yes 8/169 ... yes 8/170 ... yes 8/171 ... yes 3/173 ... yes 3/174 ... yes 17/175 ... yes 58/176 ... yes 3/177 ... yes 8/178 ... yes 8/179 ... yes 3/180 ... yes 2/181 ... yes 7/182 ... yes 4/183 ... yes 3/185 ... yes 2/186 ... yes 8/187 ... yes 8/190 ... yes 8/191 ... yes 8/192 ... yes 8/194 ... yes 8/195 ... yes 8/196 ... yes 8/197 ... yes 8/198 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 62
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished