Narrowing replication only for one repo from Gerrit Server

825 views
Skip to first unread message

Doron Shai

unread,
Oct 29, 2015, 10:21:52 AM10/29/15
to Repo and Gerrit Discussion
Hello,

i have a repo 'main_gerrit' which i want to replicate to a stash Server.

Here is the replication.config


[remote "stash"]
    push = +refs/heads/*:refs/heads/*
    push = +refs/for/*:refs/for/*
    push = +refs/drafts/*:refs/drafts/*
    push = +refs/tags/*:refs/tags/*
    authGroup = Registered Users
    threads = 1

and when the replication starts then it is trying to replicate all repos that are on my Gerrit Server...

[2015-10-29 16:15:58,096] [75910646] Replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git started...
[2015-10-29 16:15:58,096] [75910646] Replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git started...
[2015-10-29 16:15:58,493] [75910646] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git
[2015-10-29 16:15:58,493] [75910646] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git
[2015-10-29 16:15:58,494] [b5977e3c] Replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git started...
[2015-10-29 16:15:58,493] [75910646] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git
[2015-10-29 16:15:58,493] [75910646] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc.git
[2015-10-29 16:15:58,494] [b5977e3c] Replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git started...
[2015-10-29 16:15:58,889] [b5977e3c] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git
[2015-10-29 16:15:58,889] [b5977e3c] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git
[2015-10-29 16:15:58,889] [f56c163d] Replication to ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git started...
[2015-10-29 16:15:58,889] [b5977e3c] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git
[2015-10-29 16:15:58,889] [b5977e3c] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/cipoc2.git
[2015-10-29 16:15:58,889] [f56c163d] Replication to ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git started...
[2015-10-29 16:15:59,317] [f56c163d] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git
[2015-10-29 16:15:59,317] [f56c163d] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git
[2015-10-29 16:15:59,317] [f56c163d] Created remote repository: ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git
[2015-10-29 16:15:59,317] [f56c163d] Missing repository created; retry replication to ssh://jen...@stash.domain.com:7999/gpoc/gerrit_main.git

so the problems are:
1. I want to stop replication of all other repos
2. the replication is not really working...

please assist

Doron

Message has been deleted
Message has been deleted

Doron Shai

unread,
Oct 29, 2015, 10:56:35 AM10/29/15
to Repo and Gerrit Discussion
The problem was on the stash side - missing permissions.
Still - how will i be able to narrow the replication only to specific repos i want...?

Doron Shai

unread,
Oct 29, 2015, 11:24:36 AM10/29/15
to Repo and Gerrit Discussion
Solved.

Anushree Ganjam

unread,
Nov 1, 2015, 1:46:29 AM11/1/15
to Repo and Gerrit Discussion
Hi Doron,
I have the done replication successfully,
But it is doing replication for all repo
How to modify the replication.config to replicate a specific repo??

Thanks
Anushree

Doron Shai

unread,
Nov 1, 2015, 2:43:53 AM11/1/15
to Repo and Gerrit Discussion
All you have to do is adding the "projects" attribute to the replication.config in order to explicitly set the projects to be replicated.

[remote "hostname"]
  url
= gerrit@hostname/test/git/${name}
  projects
= your_project_name

Here is the part in Documentation which explain it (I missed it before.....)


Specifies which repositories should be replicated to the remote. It can be provided more than once, and supports three formats: regular expressions, wildcard matching, and single project matching. All three formats match case-sensitive.

Values starting with a caret ^ are treated as regular expressions. ^foo/(bar|baz) would match the projects foo/bar, and foo/baz. Regular expressions have to fully match the project name. So the above example would not match foo/bar2, while ^foo/(bar|baz).* would.

Values that are not regular expressions and end in * are treated as wildcard matches. Wildcards match projects whose name agrees from the beginning until the trailing *. So foo/b* would match the projects foo/bfoo/bar, and foo/baz, but neither foobar, nor bar/foo/baz.

Values that are neither regular expressions nor wildcards are treated as single project matches. So foo/bar matches only the project foo/bar, but no other project.

By default, replicates without matching, i.e. replicates everything to all remotes.

Anushree Ganjam

unread,
Nov 1, 2015, 10:59:51 PM11/1/15
to Repo and Gerrit Discussion
Thanks Doron,
How about the push tag??
Should i mention any specific branch in this?

My replication.config looks like
[remote "testreplica164"]
  url = ger...@14.142.24.164:8080:/home/gerrit2/gerrit_testsite/git//${name}.git
  projects = tmp_replica
  push = +refs/heads/android-5.1.1_r24_new:refs/heads/android-5.1.1_r24_new
  push = +refs/tags/*:refs/tags/*
  threads = 4

android-5.1.1_r24_new : this is branch in tmp_replica project.
Is this replication.config ok?

Anushree Ganjam

unread,
Nov 1, 2015, 11:42:47 PM11/1/15
to Repo and Gerrit Discussion
Hi Doron,

Also I have one more query.
Currently on the host server I have 3 repositories kitkat, jellybean, lollipop. These are the folders present in gerrit_testsite/git on master server

Now I want to replicate only Lollipop project. Should i create a mirror on the slave machine first and then try to replicate ??
Should the folder name be lollipop on both master and slave servers??
Because replication is not creating any folder on slave machine by itself.
If my question is not clear, I can explain again.
Please help me

Doron Shai

unread,
Nov 2, 2015, 2:42:50 AM11/2/15
to Repo and Gerrit Discussion
As i am not so experienced with the replication git (just started using it 1 month ago) I am not sure I can assist you, but I will try.

The push tag seems to be fine if the only branch that you want to replicate is the one you mentioned.

I think that you do not need to create such repository on the target as I know that by default there is a feature of the plugin that create missing repositories (the attribute of it is called createMissingRepositories and it is true by default)

Anushree Ganjam

unread,
Nov 2, 2015, 3:10:43 AM11/2/15
to Repo and Gerrit Discussion
Thanks Doron.
Now The replication is success.
But in the replication_log,
[4ad5d5dc] Push to ger...@14.142.24.164:8080:/home/gerrit2/gerrit_testsite/git/tmp_replica/platform/packages/apps/Browser.git references: [RemoteRefUpdate[remoteName=refs/heads/android-5.1.1_r24_new, NOT_ATTEMPTED, (null)...d16aaec37d44ab1b200b4c799feacc6a7f873af7, srcRef=refs/heads/android-5.1.1_r24_new, forceUpdate, message=null], RemoteRefUpdate[remoteName=refs/changes/90/1090/1, NOT_ATTEMPTED, (null)...d16aaec37d44ab1b200b4c799feacc6a7f873af7, srcRef=refs/changes/90/1090/1, forceUpdate, message=null]]
[2015-11-02 06:52:28,729] [4ad5d5dc] Replication to ger...@14.142.24.164:8080:/home/gerrit2/gerrit_testsite/git/tmp_replica/platform/packages/apps/Browser.git completed in 3105 ms


do you have any idea on What is this NOT_ATTEMPTED?

Even though replication is success, the code is not synced in the slave server.

Thanks
Anushree

Doron Shai

unread,
Nov 2, 2015, 4:44:10 AM11/2/15
to Repo and Gerrit Discussion
are you sure that on the target side the user that does the replication has the required authorizations?

Anushree Ganjam

unread,
Nov 2, 2015, 5:19:00 AM11/2/15
to Repo and Gerrit Discussion
Yes Doron,
the user has permission.
Because now i tried, using same replication.config and replication could create the repository by itself on the slave server.
1. But in the repository created on the slave server, I cannot find manifest.xml , default.xml inside the replicated repository  (Inside .repo folder)
I am new to replication. Even i am unable to see the branches in this replicated repository.
2. Can we clone the code from this replicated repository?

Doron Shai

unread,
Nov 3, 2015, 7:17:21 AM11/3/15
to Repo and Gerrit Discussion
Can you confirm that you do see the branches from A replicated to B but the files are not there?
Can you create a new branch on A and then check if it was replicated to B?

Anushree Ganjam

unread,
Nov 3, 2015, 11:43:05 PM11/3/15
to Repo and Gerrit Discussion
Hi Doron,
No. Branches present in A is not replicated to B.

Have you already tried replication? Is there manifest.xml inside your replicated repository's .repo folder??
Can you confirm?


Thanks

Reply all
Reply to author
Forward
0 new messages