commit | 7aad48c7427020ac4ca4687f6b8fe71712a9df41 | [log] [tgz] |
---|---|---|
author | Saša Živkov <sasa.zivkov@sap.com> | Thu Nov 29 15:50:29 2018 +0200 |
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Thu Nov 29 13:50:29 2018 +0000 |
tree | 0526989e932e0aa642ef1b270e751fba3b2cdc6e | |
parent | e0393216b8308b39ddce1ef74174f5e2c2d0ef19 [diff] |
Update git submodules * Update plugins/replication from branch 'master' to 3ce09db0cae09038f2924f1ff8f097e6c91c7a1e - Implement AdminApi using Gerrit's REST API When a remote site is a Gerrit server, we can use its REST API to perform admin operations: create missing projects, delete project, update project's head. Admin operations, when a remote site is a Gerrit server, were already supported over SSH protocol. This change implements AdminApi using Gerrit's REST API. This is useful when replicating to a remote Gerrit server which doesn't run the SSH daemon. Change-Id: I1fdb8f60b551651e3c4c402e021390a27d678896 - Execute all admin operations from the replication queue thread pool Before this change, the delete-project and update-head operations were executed from the calling Gerrit core thread while the create-project was executed in the context of the PushOne operation which is run from the replication queue. Tasks executed from the replication queue are created from an additional child injector which provides more bindings, among others the RemoteConfig. Having access to RemoteConfig from an admin task may be necessary in order to retrieve HTTP credentials, like the PushOne task does. This will be necessary when we implement admin operations over the HTTP/REST protocol. Change-Id: Iae608aa98474d6405b26bbae2508183c2d0cb212 - Create missing repository only at the remote we are pushing to When replication of a ref failed due to missing remote repository at one remote site, we then initiated creation of the missing repository on all remotes where this repository is replicated. The creation of the missing repository is considered to be success if it succeeded for all remotes and only in this case the ref replication was rescheduled. This logic could cause a ref replication to not be rescheduled when creation of a missing repository fails in a remote which is unrelated to the current push operation. For example, if we replicate to two remote sites: [remote "foo"] url = https://foo.org/... adminUrl = ssh://gerrit@foo.org/... [remote "bar"] url = https://bar.org/... adminUrl = ssh://gerrit@bar.org/... and if during a push to "foo" we find that the repository is missing then we will try to create it on both "foo" and "bar". It could happen that the creation of the missing repository succeeds on "foo" and then fails on "bar" because "bar" is unreachable or down at that moment. In this case the replication to "foo" will not be rescheduled but it should be as we successfully created the missing repository in "foo". Create missing repository only under the (admin) URL in the same remote. Note that there will be one ref replication task for each remote which ensures that the missing repository will be created in all remotes. Change-Id: Idbc3f614df53bb3aabcc4cf6cb0d6540e7000e29 - Remove the NewProjectCreatedListener implementation Initial version of this plugin implemented the NewProjectCreatedListener in order to create missing repositories in the replication targets. This was the only way how replication plugin created missing repositories. Since I4e587cdfca09445c9b1c528b2f1edae0944aec68, if during the replication of a ref it is found that the repository missing on the remote site it will be automatically created. This means, that since that change there are two ways a repository is created on the remote site: 1: from the NewProjectCreatedListener.onNewProjectCreated 2: during ref replication when the repository is missing There are two major differences in how cases 1 and 2 are invoked. In the case 1 the remote repository creation is performed from the calling thread, which means from the Gerrit core thread which invokes NewProjectCreatedListener(s). In the case 2, the creation of the remote repository is done from the replication queue thread which was processing the ref replication. Note that replication tasks are created with an additional child injector [1] which provides additional bindings available for injection into the classes implementing the replication and repository creation. These binding are, however, not available when the repository creation is processed from the Gerrit core thread invoking NewProjectCreatedListener(s). Removing the NewProjectCreatedListener implementation removes this asymmetry and makes sure that all replication relevant steps, including repository creation, are processed from replication queue threads. [1] https://gerrit.googlesource.com/plugins/replication/+/871da5aa023bdfd03a3b943f7f6b82c7e0f16341/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java#189 Change-Id: I32e7aa632ffe0e94eb525f7f2c007fbb88569004 - Consistently handle remote repository creation failures Failure to create remote repository was handled inconsistently in the three existing AdminApi implementations. This issue was present in the code even before the refactoring done in Ie760bf3e143b1d143b6e81ac6cfa816ef1f8d016. For example, creation of remote repository over SSH [1] didn't return a status back to the caller, while the Gerrit+SSH implementation [2] did return a boolean flag which was afterwards ignored by the caller [3]. Not handling remote repository creation failures had an ugly effect: we log the "Missing repository created; ..." [4], even if the repository creation failed. Let all three implementations of the AdminApi return a flag indicating the success/failure and make sure to handle it properly. Further, remove some redundant and potentially confusing parts of the log messages as they assume that failure to create missing repository can only be caused by using wrong protocol. [1] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java#290 [2] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java#43 [3] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java#259 [4] https://gerrit.googlesource.com/plugins/replication/+/092792edacf9c29732a560a30967b92664cd65f9/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java#400 Change-Id: I6566f867138ab73c81ff7a67630772c3734e501b - Fix creation of missing repository when replicating to a Gerrit server When replicating to a Gerrit server over http, non-existence of a repository is reported as: <repo-name> unavailable This message wasn't among expected messages and creation of the missing repository wasn't executed. Change-Id: I3d6c3e14573b638b17d54d1777a606b8f356f1f9
Gerrit is a code review and project management tool for Git based projects.
Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.
For information about how to install and use Gerrit, refer to the documentation.
Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.
Please report bugs on the issue tracker.
Gerrit is the work of hundreds of contributors. We appreciate your help!
Please read the contribution guidelines.
Note that we do not accept Pull Requests via the Github mirror.
The IRC channel on freenode is #gerrit. An archive is available at: echelog.com.
The Developer Mailing list is repo-discuss on Google Groups.
Gerrit is provided under the Apache License 2.0.
Install Bazel and run the following:
git clone --recurse-submodules https://gerrit.googlesource.com/gerrit cd gerrit && bazel build release
The instruction how to configure GerritForge/BinTray repositories is here
On Debian/Ubuntu run:
apt-get update & apt-get install gerrit=<version>-<release>
NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.
On CentOS/RedHat run:
yum clean all && yum install gerrit-<version>[-<release>]
On Fedora run:
dnf clean all && dnf install gerrit-<version>[-<release>]
Docker images of Gerrit are available on DockerHub
To run a CentOS 7 based Gerrit image:
docker run -p 8080:8080 gerritforge/gerrit-centos7[:version]
To run a Ubuntu 15.04 based Gerrit image:
docker run -p 8080:8080 gerritforge/gerrit-ubuntu15.04[:version]
NOTE: release is optional. Last released package of the version is installed if the release number is omitted.