Last modified: 2013-07-17 14:30:44 UTC
Currently, Gerrit repositories get automatically prefixed with their parent project such that the 'puppet' repo is called 'operations-puppet'. This is a request to allow for custom naming of the Github repo.
Currently the gerrit replication plugin only supports minimal slash '/' replacement in gerrit repository names. We'd like to add support for arbitrary mapping from a gerrit repository name to any name in a replication.config file.
(In reply to comment #0) > Currently, Gerrit repositories get automatically prefixed with their parent > project such that the 'puppet' repo is called 'operations-puppet'. In gerrit, project names are strings. Slash is not a special character. For example “operations/dumps” is not the parent of “operations/dumps/archiving”. For gerrit, those two projects are unrelated. > operations-puppet Some git servers do not like special characters (like '/') in their repo names. So for example if you try to create a repository on github with name operations/puppet github presents a warning Will be created as operations-puppet . Hence, indeed “operations-puppet” is the correct github name for “operations/puppet”.
(In reply to comment #1) > Currently the gerrit replication plugin only supports minimal slash '/' > replacement in gerrit repository names. That's only partly true. You can push to whatever Url you like, so you can push to whatever name you choose. So any renaming is possible already now. However, automatic substituting of ${name} is currently only implemented for * '/' -> '-', and * '/' -> '_'. > We'd like to add support for > arbitrary > mapping from a gerrit repository name to any name in a replication.config > file. That sounds like a request for obfuscation to me :-) Or is there something wrong with the way we name our repos in gerrit? If you do not want to do automatic mangling of ${name} you can go straight for the Url to push to. If you prefer automatic mangling, the code at src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java:getURIs:360 in the replication plugin should get you started. P.S.: Bear in mind that the other day, someone asked how to arrive at a repo's gerrit name, if all we know is the github's repo name. So I'd be all for keeping the translation between names as simple as possible ... and if that's possible: reasonaly close to being two-way.
> Or is there something wrong with the way we name our repos in gerrit? I think yes, but this is a big discussion I haven't had the guts to start yet. Motivation: I am maintaining puppet-cdh4 on github. I have active contributors I don't want to lose. I need to move the main hosting of this project over to gerrit. Operations wants me to name this operations/puppet/cdh4, which when replicated to github will be operations-puppet-cdh4. I think it is more correct to name this gerrit repo puppet/cdh4, since the puppet module itself is 100% non WMF operations specific. But, unless/until that discussion is settled, I have to keep name this under the operations/ prefix. Arbitrary name mapping would allow us to side step this problem, and to make gerrit projects that we want to be prominent open source contributions to be more visible to the world on Github.
BTW, I have had long discussions with Chad and Mark and Faidon about this. I even discussed implementation with Chad a bit about it.
(In reply to comment #5) > BTW, I have had long discussions with Chad and Mark and Faidon about this. I > even discussed implementation with Chad a bit about it. Yes, and I wasn't opposed to it at the time...but then this happened: (In reply to comment #3) > P.S.: Bear in mind that the other day, someone asked how to arrive at a > repo's gerrit name, if all we know is the github's repo name. So I'd be > all for keeping the translation between names as simple as possible > ... and if that's possible: reasonaly close to being two-way. And the problems of breaking the 1:1 mapping became clear. Again, it's not a deal breaker, but it does present problems.
> If you do not want to do automatic mangling of ${name} you can go straight for the Url to push to. Hm, wait, we can do this manually? That's fine for my purposes. I'm not sure how though. As far as I can tell, the replication.config handles replication of all repositories to each defined remote and url. How would a replication.config section that only replicates a particular repository with a manual url (no ${name}) expansion look?
But how important is it really to be able to automatically infer the Gerrit repo name from the github repo name? A simple reference in the README.md to the Gerrit repo name can do as well.
In addition to the README you can set the URL for the repo to be the URL for the same repo at gerrit unless there's some better place to link to. But yeah, README should be good enough in the few cases where it's not a 1:1 mapping.
(In reply to comment #7) > > If you do not want to do automatic mangling of ${name} you can go > straight for the Url to push to. > > Hm, wait, we can do this manually? That's fine for my purposes. Yes, of course you can :-) ... But then I realized that I added this functionality only locally, when testing replication some time back :-( I now added documentation and pushed it to upstream: https://gerrit-review.googlesource.com/#/c/44710/ It does not meet this bug's request to have custom renaming, but it would allow to replicate operations/puppet/cdh4 (gerrit) -> puppet-cdh4 (github) in /addition/ to the standard operations/puppet/cdh4 (gerrit) -> operations-puppet-cdh4 (github) . To get this, you'd just have to add another remote section to gerrit's repository.config. Something like: [remote "github-extra-cd4"] url = [github-push-url]/puppet-cdh4 project = operations/puppet/cdh4 That said, I am still not yet convinced that departing from our 1:1 mapping is a good idea... fortunately, I need not decide that :-)
I wonder if we could combine the approach I did awhile back in https://gerrit-review.googlesource.com/#/c/37711/ with that.
Awesome! This is all I really need to feel all warm and squishy. Is this live in our gerrit? Or do we need to wait until its accepted and we upgrade?
Would like them merged so we don't fork, but since they're parts of the replication plugin (and not core) upgrading is easy.
Hm, ok. Any idea of how long it might take to get them merged and upgraded?
Bump! How goes it? :)
Fixing topic to mention GitHub instead of Git.
Krinkle, I think the mirror git URL is arbitrary, we just happen to use mailny GitHub as a mirror. Aaaaand, any updates on this? :)
Change 71248 had a related patch set (by QChris) published: Replicate operations/puppet/cdh4 to puppet-cdh4 on github https://gerrit.wikimedia.org/r/71248
(In reply to comment #17) > Aaaaand, any updates on this? :) Of course, there are updates: Gerrit has been upgraded, so we should finally be able to get custom replication working. Above change should replicate operations/puppet/cdh4 additionally to puppet-cdh4 on github. Are there other repos as well that have a following under a different name?
Change 71248 merged by Ottomata: Replicate operations/puppet/cdh4 to puppet-cdh4 on github https://gerrit.wikimedia.org/r/71248
There are more repos! Let's see if this works, then I will work with you to get the rest syncing.
With the latest update of gerrit some weeks back, it's possible to replicate repos to other additional names. In the meantime, this happened at least for * operations/puppet/cdh4 * operations/puppet/jmxtrans * analytics/kafka and it's working fine. If it's custom replication is required for further projects, it can be realized in the same way.