1
0
mirror of https://github.com/gryf/ferrit.git synced 2026-02-07 08:45:53 +01:00

Implement method /a/changes.

After gerrit recives an action (like creating a review, comment, and so
on) it will send appropriate json from ssh server. Jenkins, which is
listening on the ssh channel will receive this message and do
appropriate action (for example, it will do the build/test whatever),
and sends back notification back to HTTP gerrit server to /a/changes
endpoint. There are couple of requests to that url, which will indicate
what jenkins is doing (like starting build, sending result info).
This commit is contained in:
2019-10-27 17:42:36 +01:00
parent 283cb787bb
commit 9605cb22f0

View File

@@ -31,11 +31,19 @@ def projects(params=None):
"target": "_blank"}]}}
@bottle.post('/a/changes')
def changes(param=None):
print(param)
print(bottle.request.json)
pass
@bottle.post('/a/changes/<project>~<branch>~<id>/revisions/<commit_id>/review')
def changes(project, branch, id, commit_id):
# We are looking for labels in the json
labels = bottle.request.json.get('labels', {})
if not labels:
return
# TODO(gryf): It's on gerrit side now. What we do with this information on
# Ferrit? Verified is either 1 or -1, which indicates build in jenkins
if labels.get('Verified') == 1:
return True
else:
return False
@bottle.route('/a/plugins/events-log/events/')