#93 Could not execute pre_push_check: Branchname: mcatanzaro/portal-helper-c8s is not valid
Opened 6 months ago by catanzaro. Modified 12 days ago

Hi, moving this from https://pagure.io/rpkg/issue/702,

Today I had to disable centpkg's pre_push_check (a shame) because it didn't like the name of the branch I had created:

$ centpkg pre-push-check
Could not execute pre_push_check: Branchname: mcatanzaro/portal-helper-c8s is not valid

I have no clue what it doesn't like about the branch name because it does not say. The rpkg developers found the error here:

https://git.centos.org/centos/centpkg/blob/a918727374da68eee4efea99437553e2420dd77c/f/src/centpkg/__init__.py#_88

It looks like this check is intended to prevent packagers from pushing random branches to the primary development repo rather than forks, but centpkg is checking the URL of the remote named origin rather than checking the repo that is actually being pushed to. In this case, I was pushing to my fork, not to origin, but the hook blocked me anyway. I don't think there should be any restrictions on names of branches pushed to forks.


Um sorry, a little hard to believe I reported this issue twice without realizing the problem, but I'm pretty sure I was just missing the --release=c8s argument. I'm just going to close this in shame and we'll pretend it didn't happen.

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

6 months ago

Um, sorry again. I think I was very confused when I closed this issue. This bug is a problem with the git push hook that blocked me from running git push, not a problem when running centpkg, so the --release=c8s argument is not relevant as you can't pass that flag to git push.

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

6 months ago

Sounds like you had quite the day yesterday.
Not passing along the argument does seem like a bug of centpkg, although it might be a rpkg bug. Thank you for opening this issue.
It's going to be at least two days before I can work on this. I hope you don't mind doing the work-around until then, which is to run the git command, with the argument, manually.

Metadata Update from @tdawson:
- Issue tagged with: Bug

6 months ago

Are you suggesting that I run git push --release=c8s? That is not going to work because --release is a centpkg flag, not a git push flag.

I think the only way to push is to remove the git hook. I already removed it, so I'm not inconvenienced by this.

So I can reproduce this properly, and know when it's fixed, can you give me the steps you did. I think this is it, but not sure.

git clone git@gitlab.com:<user>/<package>.git ; cd <package>
git checkout -b <my-branch-name>
# Make some changes
centpkg pre-push-check

If that is correct, I am not seeing the error. I'm seeing a warning that this was detected as a fork and is ignoring branch name checking.
Are you running centpkg-0.8.3 ?
If so, can you tell me which steps I am missing to reproduce this?

Off ticket I was told how they were doing it. Putting it here so it is saved.

centpkg clone <package> ; cd <package>
git remote add me git+ssh://git@gitlab.com/<user>/<package>.git
git checkout -b useless-change
git commit --allow-empty -m "This is a useless commit"
git push -u me useless-change

This is giving me the error seen, so I can reproduce it.
Working on the fix.

Just letting you know that this is being worked on, but it's not a simple fix.
The underlying problem is that pre-push-check is not given any information about the remote repository we are trying to push to.

Login to comment on this ticket.

Metadata