commit | 743454d4d651e882c87f70df8f269c549062529a | [log] [tgz] |
---|---|---|
author | Antonio Barone <syntonyze@gmail.com> | Fri Jul 23 14:44:54 2021 +0200 |
committer | Antonio Barone <syntonyze@gmail.com> | Wed Aug 04 10:53:51 2021 +0200 |
tree | 5648206a49a89626163cab741f8e5e535d367591 | |
parent | d068a535121b8545e9f3789ccc06704efe29a57a [diff] |
Consume and expose pull-replication status Consume all RemoteRefReplicationEvent events in order to consume both push or pull-replication events. Expose the type of the replication (PUSH or FETCH) to the REST-API response payload. Bug: Issue 14804 Change-Id: I3672c1ee49c676ae518e46b85e2472362b3b1970
Record and display the repository's replication status without having to dig into the Gerrit replication_log
Consumes replication events and updates a cache with the latest replication status of specific refs to specific remotes.
The cache information is then exposed via a project's resource REST endpoint:
curl -v --user <user> '<gerrit-server>/a/projects/<project-name>/remotes/<remote-url>/replication-status'
For instance, to assess the replication status of the project some/project
to the https://github.com/some/project.git
URL, the following endpoint should be called:
curl -v --user <user> '<gerrit-server>/a/projects/some%2Fproject/remotes/https%3A%2F%2Fgithub.com%2Fsome%2Fproject.git/replication-status'
A payload, similar to this may be returned:
{ "remotes": { "https://github.com/some/project.git": { "status": { "refs/changes/01/1/meta": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688830 }, "refs/changes/03/3/meta": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688854 }, "refs/changes/03/3/1": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688854 }, "refs/changes/02/2/1": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688844 }, "refs/changes/02/2/meta": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688844 }, "refs/changes/01/1/1": { "type": "PUSH", "status": "SUCCEEDED", "when": 1626688830 }, "refs/changes/04/4/meta": { "type": "PULL", "status": "SUCCEEDED", "when": 1628000641 }, "refs/changes/04/4/1": { "type": "PULL", "status": "SUCCEEDED", "when": 1628000641 } } } }, "status": "OK", "project": "some/project" }
The endpoint returns different HTTP response code depending on the result:
The REST-API response shows a status
field, which shows the overall replication-status of the projects for the specified remote.
OK
- all the refs have successfully replicatedFAILED
- Some refs have not replicated successfully