[go: up one dir, main page]

Skip to content

Push rule is not being checked on tag pushes

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The "Check whether the commit author is a GitLab user" push rule is not being checked when pushing tags.

Steps to reproduce

  1. Setup a new repository
  2. Enable "Check whether the commit author is a GitLab user"
  3. Make a commit using a bogus user like alice@example.com
  4. Make a tag
  5. Push the tag

Example Project

https://gitlab.com/nuxi/push-rule-bug

What is the current bug behavior?

The tag is accepted because the push rule wasn't checked.

What is the expected correct behavior?

The tag is rejected because the push rule failed. Just like would happen if it was a branch.

Relevant logs and/or screenshots

Basic setup:

$ git config --local user.name Alice
$ git config --local user.email alice@example.com
$ echo "Hey Bob, how you doing?" > README.md 
$ git commit -a -m "Message for Bob"
[main 9fb39d1] Message for Bob
 1 file changed, 1 insertion(+), 92 deletions(-)
 rewrite README.md (100%)

We can easily verify that the push rule is working for branches:

$ git push origin
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1/1), done.
Writing objects: 100% (3/3), 264 bytes | 264.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: GitLab: Author 'alice@example.com' is not a member of team
To gitlab.com:nuxi/push-rule-bug.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'gitlab.com:nuxi/push-rule-bug.git'

But if you make a tag and push it, the push is accepted:

$ git tag moof
$ git push origin moof
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1/1), done.
Writing objects: 100% (3/3), 264 bytes | 264.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To gitlab.com:nuxi/push-rule-bug.git
 * [new tag]         moof -> moof

Output of checks

This bug happens on GitLab.com (which currently runs 14.10.0-pre)

I originally discovered it on a private instance running 14.3.2-ee.

Possible fixes

Unknown.

Edited by 🤖 GitLab Bot 🤖