This bot utilizes the Gerrit REST API to query for new changes made to Gerrit within a certain amount of time and performs a set of tests on the changes. Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Change-Id: I9d5af31d952bc0cd791f1569e6aac7c270e687e4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34737 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
Gerrit Bot
Getting Username and Password
-
Follow this link https://gem5-review.googlesource.com/new-password and copy the authenticating script to a file, supposedly
gerrit_auth_script. -
After that, run the
extract_gitcookies.pyto extract the username and password from the obtained script. For example, the following command extracts the username and password fromgerrit_auth_scriptand writes them toGEM5_BOT_AUTH_INFO,
python3 extract_gitcookies.py gerrit_auth_script GEM5_BOT_AUTH_INFO
The GEM5_BOT_AUTH_INFO will have two lines: the first line contains the
username and the second line is the corresponding password.
Notes:
- The above link, https://gem5-review.googlesource.com/new-password, generates a new pair of username and password per visit.
- The
extract_gitcookies.pyfile is also able to read from.gitcookiesfile. For example,python3 extract_gitcookies.py ~/.gitcookies outputwill write all pairs of username and password in two lines per pair tooutput. - The gerrit-bot only reads the pair of username and password appearing
in the first and the second line in the
GEM5_BOT_AUTH_INFOfile.
Gerrit Bot
Notes: this is likely to be changed.
The idea of implementing the bot is as follows,
- The
Configsclass should contain all constants that are configurable prior to running. - Classes such as
LabelInfoandReviewInputare simplied versions resembling those data structures of the same name according to the Gerrit REST API documentation. - In the class
GerritRestAPIRequester,- The
__generate_*_request()functions should be a one-to-one function to a set of Gerrit REST API endpoints. The functions should generate arequests.Requestobject. - The
send_*()functions are adapted to a more specific use case.
- The
Gerrit API
- Query options: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#query-options
Appendix I. extract_gitcookies.py
This script extracts all pairs of username and password from the gerrit authentication script from a file or a .gitcookies file.
The usage of the script is as follows,
python3 extract_gitcookies.py input_path output_path
Appendix II. MAINTAINERS.json
This file should be consistent with the file MAINTAINERS.