#10528 src.fp.o: Cannot activate the "Prevent creating new branches by git push" hook
Closed: Fixed 2 years ago by kevin. Opened 3 years ago by churchyard.

Describe what you would like us to do:

  1. I go to https://src.fedoraproject.org/rpms/python-u-msgpack-python/settings#hooks-tab
  2. I expand Prevent creating new branches by git push
  3. I check Active
  4. I click Update
  5. The URL changes to https://src.fedoraproject.org/rpms/python-u-msgpack-python/settings/Prevent creating new branches by git push and there is a 500 fatal error

Could you please activate the hook for me?

When do you need this to be done by? (YYYY/MM/DD)

No particular deadline.


Metadata Update from @mohanboddu:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: medium-gain, medium-trouble, ops

3 years ago

So, this means those packages can never have stream branches right?

Also, do we want to allow some packages to set this and not others? It might be nice to be consistent here.

Metadata Update from @kevin:
- Issue untagged with: medium-gain, medium-trouble, ops
- Issue priority set to: Needs Review (was: Waiting on Assignee)

3 years ago

They can have stream branches. The hook can be explicitly disabled for the first push and then reenabled. Same for new epel branches etc. It just prevents accidental pushes to origin instead of fork.

I already have this active on dozens of packages. All packages should be allowed to set it, it just doesn't work.

So, the error here is:

46821] [2022-02-07 20:15:12,711] ERROR in app: Exception on /rpms/python-u-msgpack-python/settings/Pr
event creating new branches by git push [POST]                                                       
[Mon Feb 07 20:15:12.712483 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821] Traceback (most recent call last):                                                            [Mon Feb 07 20:15:12.712495 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821]   File "/usr/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app               
[Mon Feb 07 20:15:12.712505 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     response = self.full_dispatch_request()                                                   [Mon Feb 07 20:15:12.712514 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request   [Mon Feb 07 20:15:12.712524 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     rv = self.handle_user_exception(e)                                                        
[Mon Feb 07 20:15:12.712532 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception   
[Mon Feb 07 20:15:12.712541 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     reraise(exc_type, exc_value, tb)                                                          
[Mon Feb 07 20:15:12.712549 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise               
[Mon Feb 07 20:15:12.712558 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     raise value                                                                               
[Mon Feb 07 20:15:12.712566 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request   [Mon Feb 07 20:15:12.712583 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     rv = self.dispatch_request()                                                              
[Mon Feb 07 20:15:12.712592 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request        
[Mon Feb 07 20:15:12.712601 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     return self.view_functions[rule.endpoint](**req.view_args)                                
[Mon Feb 07 20:15:12.712610 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821]   File "/usr/lib/python3.6/site-packages/pagure/utils.py", line 396, in decorated_function    
[Mon Feb 07 20:15:12.712619 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821]     return function(*args, **kwargs)                                                          
[Mon Feb 07 20:15:12.712627 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/pagure/decorators.py", line 113, in check_repo_admin 
[Mon Feb 07 20:15:12.712636 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     return function(*args, **kwargs)                                                          
[Mon Feb 07 20:15:12.712645 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]   File "/usr/lib/python3.6/site-packages/pagure/ui/plugins.py", line 156, in view_plugin      
[Mon Feb 07 20:15:12.712657 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821]     plugin.set_up(repo)                                                                       
[Mon Feb 07 20:15:12.712666 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:46821]   File "/usr/lib/python3.6/site-packages/pagure/hooks/__init__.py", line 184, in set_up       
[Mon Feb 07 20:15:12.712691 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821]     os.unlink(target)                                                                         [Mon Feb 07 20:15:12.712704 2022] [wsgi:error] [pid 2101622:tid 139991397353216] [remote 10.3.163.74:
46821] PermissionError: [Errno 13] Permission denied: '/srv/git/repositories/requests/rpms/python-u-m
sgpack-python.git/hooks/pre-receive'    

But why is it trying to change the requests repo here?
CC @pingou

Metadata Update from @mohanboddu:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: medium-gain, medium-trouble, ops

3 years ago

[backlog refinement]
We found out that the /srv/git/repositories/requests/rpms/python-u-msgpack-python.git/hooks/pre-receive symlink is pointing to wrong file
lrwxrwxrwx. 1 root packager 62 Nov 20 2018 /srv/git/repositories/requests/rpms/python-u-msgpack-python.git/hooks/pre-receive -> /usr/lib/python2.7/site-packages/pagure/hooks/files/hookrunner

Pagure is now on python 3.6

This is now fixed. :)

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Could you please fix this with all other packages as well?

I get the same error e.g. with https://src.fedoraproject.org/rpms/mu/settings#hooks-tab

Metadata Update from @churchyard:
- Issue status updated to: Open (was: Closed)

2 years ago

I have now fixed all of these.

Can you please let us know if you see anymore?

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Thanks, I will open a new ticket, if it ever happens again.

I get the same error e.g. with https://src.fedoraproject.org/rpms/mu/settings#hooks-tab

Actually, I still get this error even for the package I mentioned here in this ticket, so reopening instead.

Metadata Update from @churchyard:
- Issue status updated to: Open (was: Closed)

2 years ago

Ah, there was a selinux denial behind the permissions errors I fixed.

Try again now?

(I actually set it on mu as a test)

Indeed looks fixed now, thanks again.

Excellent. Let me know if you hit another one, they should all be fixed...

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Log in to comment on this ticket.

Metadata
Boards 1
ops Status: Backlog