[openstack-dev] [Infra][all] Synchronizing local Git and Gerrit repositories

Ricardo Carrillo Cruz ricardo.carrillo.cruz at gmail.com
Mon Oct 27 16:11:23 UTC 2014


I think what you are trying to achieve is to have a branch that tracks
upstream for the upstream projects, and another branch that tracks local
development in your Gerrit project.
You may want to check Jeepyb:

http://ci.openstack.org/jeepyb.html

That tool is what Openstack CI uses to manage gerrit repo creation.
Let's take as an example that you wanted to have python-neutronclient
project in your Gerrit, that tracks upstream.

You would do something like this:

1. Install jeepyb and configure the projects.ini file according to your
environment.
1. Add python-neutronclient.config file to the folder your manage-projects
expect it to find (acl-dir parameter from previous step), with contents
similar to :

[access "refs/heads/*"]


abandon = group neutron-core


label-Code-Review = -2..+2 group neutron-core


label-Workflow = -1..+1 group neutron-core





[access "refs/heads/proposed/*"]


abandon = group neutron-milestone


label-Code-Review = -2..+2 group neutron-milestone


label-Workflow = -1..+1 group neutron-milestone





[access "refs/tags/*"]


pushSignedTag = group neutron-release





[receive]


requireChangeId = true


requireContributorAgreement = true





[submit]


mergeContent = true

2. Create an entry in gerrit/projects.yaml file from project-config repo
like:

- project: openstack/python-neutronclient


  upstream: https://git.openstack.org/openstack/python-neutronclient


  options:


    - track-upstream

3. Run 'manage-projects python-neutronclient'

After this, the tool would create the project 'python-neutronclient' with
the acl defined from step 1 and set it to track upstream (as per the option
depicted on step 2).
After this, you could just create branches off master from the Gerrit UI
(or define them upfront in the acl in step 1, but this way would get you
started faster).

If you use the upstream openstack_project::review.pp manifest the
configuration to get this going is greatly reduced (it's a mega manifest
that installs gerrit, jeepyb and other things), I can help you with that.

Regards


2014-10-27 15:22 GMT+01:00 ZZelle <zzelle at gmail.com>:

> Hi Ondrej,
>
> Could you clarify your needs?
>
> If you allow your devs to commit code on your local gerrit,
> then your repo will differ from OpenStack one
> and you might have merge troubles when you will resync your repo with
> OpenStack one
> How will you handle them?
>
>
> Cédric/ZZelle
>
>
>
>
>
> On Mon, Oct 27, 2014 at 12:24 PM, Ondrej Wisniewski <
> ondrej.wisniewski at dektech.com.au> wrote:
>
>>  Hi Riccardo
>>
>> thanks for pointers you provided. I had a look at the Gerrit replication
>> feature and the description says:
>> "*Gerrit can automatically push any changes it makes to its managed Git
>> repositories to another system.*"
>>
>> What I need would be exactly the opposite. I need to update the Gerrit
>> managed Git repository with the upstream community Git repository.
>> How would I go about that?
>>
>> What I tried was defining the community repository as remote origin and
>> then do "git remote update". This updates the remote references but doesn't
>> update the local branches.
>>
>> Thanks, Ondrej
>>
>>
>> On 10/24/2014 06:56 PM, Ricardo Carrillo Cruz wrote:
>>
>> Hi Ondrej
>>
>>  The replication between Gerrit and git mirrors is done by the Gerrit
>> replication mechanism.
>>
>>  If you look at this line in the gerrit manifest:
>>
>>
>> http://git.openstack.org/cgit/openstack-infra/system-config/tree/modules/gerrit/manifests/init.pp#n255
>>
>>  you will see that it deploys a 'replication.config' file based on
>> template:
>>
>>
>> http://git.openstack.org/cgit/openstack-infra/system-config/tree/modules/gerrit/templates/replication.config.erb
>>
>>  You can find more information about how Gerrit replication works here:
>>
>>
>> http://gerrit.googlecode.com/svn/documentation/2.0/config-replication.html
>>
>>  HTH
>>
>>  Regards
>>
>> 2014-10-24 18:25 GMT+02:00 Ondrej Wisniewski <
>> ondrej.wisniewski at dektech.com.au>:
>>
>>>  Hi,
>>>
>>> I am trying to set up an OpenStack development workflow in our company.
>>> We have an internal Git repository mirror of all OpenStack projects we are
>>> working on. It is periodically updated from the upstream OpenStack
>>> community servers. This is used to share the code among developers.
>>>
>>> Furthermore I have set up a Gerrit server for the internal code review.
>>> The Gerrit server also works with repository mirrors of the community
>>> repositories which should be updated periodically. Or at least that's the
>>> idea. I ran into lots of problems and couldn't find a good way of
>>> synchronizing the developer mirrors with the Gerrit repositories.
>>>
>>> So to cut a long story short, here are my questions:
>>> How is the synchronization of the OpenStack community Git repositories
>>> and the Gerrit server done?
>>> How can I import an OpenStack project into my Gerrit system from my
>>> local Git mirror and keep both synchronized (at least the master branch) ?
>>>
>>> I would be really appreciate if someone could shed some light on this.
>>> Thanks, Ondrej
>>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141027/85d17663/attachment.html>


More information about the OpenStack-dev mailing list