Page MenuHomePhabricator

Cannot push to Gerrit repo without review
Closed, ResolvedPublic

Description

I'm having some Git/Gerrit troubles and @Gehel recommended I ask you. There are some repos that @chelsyx (chelsyx) and I (bearloga) should be able to push to, but can't. There are some repos where we'd like to be able to merge from the "develop" branch into the "master" branch without submitting that merge commit for a full CR on Gerrit.

For example, here's one of the repos I'm having difficulty with:

wikimedia/discovery/wetzel / project.config:

[access]
	inheritFrom = wikimedia/discovery
[access "refs/*"]
	owner = group Project and Group Creators
[project]
	description = Shiny dashboard for Maps metrics.

He said it that project inherits from the "discovery" project and that Chelsy and I are already owners of those projects. Indeed, we are members of the "search" group that owns wikimedia/discovery project.

But when I try to git push:

remote: Branch refs/heads/master:
remote: You are not allowed to perform this operation.
remote: To push into this reference you need 'Push' rights.
remote: User: bearloga
remote: Please read the documentation and contact an administrator
remote: if you feel the configuration is incorrect

@hashar said I could

git checkout master
git merge --no-ff develop
git push origin HEAD:refs/for/master

But this would create a change on Gerrit that we'd need to +2 and merge. We don't have CI on some of these repos (yet! But we're going to with T153856) so right now the goal is to git push the merge commit to remote from local without having to perform an extra CR in Gerrit.

Event Timeline

Change 360784 had a related patch set uploaded (by Paladox; owner: Paladox):
[search@refs/meta/config] Modify access rules

https://gerrit.wikimedia.org/r/360784

Paladox subscribed.

@mpopov hi, the above change should fix your problem :)

Could you merge it please?

If I am not mistaken, Gerrit accepts reviews for merge commits. And assuming the changes in the develop branch have been merged, you can then CR+2 the change of the merge commit, have CI kick in and submit the merge commit for you.

Lets say you have:

fork point --> A  --> B(develop) --\
     \------------------------------ merge (master)

You send A and B for review. They get merged in the develop branch.

Locally you do something like:

git checkout master
git merge --no-ff develop
git push origin HEAD:refs/for/master

That should result in the creation of a change in Gerrit for the master branch which you can review / submit as usual :-]

@hashar I think they want to do

git push origin HEAD:refs/heads/master

Mentioned in SAL (#wikimedia-releng) [2017-06-22T13:35:14Z] <hashar> Gerrit: adding Bearloga (Mikhail Popov) to the 'search' group . That also makes him an owner to wikimedia/discovery/* - T168588

@Paladox proposed a change to the Gerrit search group. Any owners of that group can then be able to edit the access lists for the search project.

Your wikimedia/discovery/* repositories are all owned by the Gerrit group "discovery". Thus I have added you to the group.

On the wikimedia/discovery project, you would then be able to add rights:

  • [Edit]
  • [Add Permission ...] -> [Push]
    • In the input box that shows: Group Name: search and press [Add]
  • [Add Permission ...] -> [Push Merge Commit]
    • In the input box that shows: Group Name: search and press [Add]

Then at the bottom [Save Changes].

I followed @hashar's instructions (I didn't even know about the access GUI!) and everything works perfectly now. Thank you!

Change 360784 abandoned by Paladox:
Modify access rules

https://gerrit.wikimedia.org/r/360784