简体   繁体   中英

Gerrit Reviewers name and email in Jenkins

I am trying to integrate Gerrit Code Review with Jenkins and I need to get an email names of all Reviewers that are assigned to a change that triggered Jenkins job. I have found this fragment of Gerrit Code Review plugin with all environmental variables listed, but there is nothing about reviewers.

My goal: send email notification about job status (in Jenkins job Post-Actions via email-ext plugin) to change owner, reviewers patchset creators and job owner.

My question is: is there any way of obtaining Gerrit Reviewers emails and parsing them into Jenkins as a variable?

You can use the REST API, like in the following example:

curl --silent --user USER:PASS --request GET  https://GERRIT-SERVER/a/changes/CHANGE-NUMBER/reviewers | sed 1d | jq --raw-output '.[].username'

See more info on Gerrit documentation here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM