This post list the details of some of the important gerrit commands which we have tried, (This post will be updated as and when we use the commands) Note: The gerrit commands are executed on Ubuntu gerrit review server https://review.opendev.org/ . You may need to register to execute same commands on this server. Check gerrit version $ ssh -p GERRIT_PORT -i PATH_TO_SSH_PRIVATE_KEY GERRIT_SERVER_URL gerrit version Example of this is, $ ssh -p 29418 -i /home/devlab/.ssh/id_rsa review.opendev.org gerrit version “-p” you can change the gerrit port used for ssh authentican.
Execution & Command Syntax
sed for ssh authenticanTechnical Implementation Details
“-i ” – specify ssh private key. Check list of projects from gerrit server $ ssh -p GERRIT_PORT -i PATH_TO_SSH_PRIVATE_KEY GERRIT_SERVER_URL gerrit ls-projects $ ssh -p 29418 -i /home/devlab/.ssh/id_rsa review.opendev.org gerrit ls-projects Get the information from gerrit server $ ssh -p GERRIT_PORT -i PATH_TO_SSH_PRIVATE_KEY GERRIT_SERVER_URL gerrit query project:{^PROJECT_NAME} --format=JSON --all-approvals --comments --all-reviewers You can use the project name as obtained using “gerrit ls-projects” command as above to get the information such as approvals, comments, reviews etc in the format of JSON. $ ssh -p 29418 -i /home/devlab/.ssh/id_rsa review.opendev.org gerrit query project:{^All-Projects} --format=JSON --all-approvals --comments --all-reviewers
Gotchas and Common Issues
Permission Verification - confirm execution permissions and path variables before invoking system binaries.
Version Compatibility - check software version release notes for deprecated flags or syntax changes.
Log Monitoring - inspect system logs (
journalctlor/var/log) to troubleshoot execution failures.
Following these steps ensures clean configuration, proper security boundaries, and reliable execution for important gerrit commands.
Comments and corrections