Deploy key with write access fails on push rules
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label. For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug For the Enterprise Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary Prior to Gitlab 12.0, a deploy key with write access was not affected by push rules **"Committer restriction"** and **"Check whether author is a Gitlab user"**. Currently it is impossible to push a commit via deploy key with either of these rules active. ### Steps to reproduce 1. Create a new empty project 1. Create a deploy key with write access 2. Commit and push a CI setup that pushes a commit in it's pipeline (see example project) 5. Start a new pipeline (it should pass) 4. Enable either combination of **"Committer restriction"** and **"Check whether author is a Gitlab user"** 5. Start a new pipeline (it should fail) ### Example Project https://gitlab.com/csvn/deploy-key-push-rule-issues-reproduction ### What is the current *bug* behavior? Push fails with "remote: GitLab: You cannot push commits for 'xxx@yyy.zzz'. You can only push commits that were committed with one of your own verified emails." or "remote: GitLab: Author 'xxx@yyy.zzz' is not a member of team" ### What is the expected *correct* behavior? Push should succeed without errors ### Relevant logs and/or screenshots https://gitlab.com/csvn/deploy-key-push-rule-issues-reproduction/-/jobs/270723700 https://gitlab.com/csvn/deploy-key-push-rule-issues-reproduction/-/jobs/270731960 ### Output of checks This bug happens on GitLab.com (12.2.0-pre 0874a8d346c) #### Results of GitLab environment info #### Results of GitLab application Check ### Possible fixes
issue