Auto adding reviewers in Gerrit just before merging

601 views
Skip to first unread message

C dev

unread,
Apr 8, 2014, 3:05:57 AM4/8/14
to repo-d...@googlegroups.com
Hi 

Currently we have a workflow 
as when a developer commits Jenkins is triggered for that patchset thro Gerrit trigger plugin and reports back +1 verified,
In the meanwhile a reviewer does the code review +2 ,
Once both are done the author then adds the reviewers to the reviewed by field to the commit message and submits it for a merge. (when submitting a patch set the reviewers are not aware of who's going to be reviewing their code, hence they add it at the end of the process before merging)

here's the problem so when he submits his change for merge he edits the commit message like below,
eg: 

Bug ID:ABCde12345 Test commit
Change-Id: I347ecgcfaf5g0g267dg008f3gb590b8e9eb6e3d4
Reviewed-By:John Doe, James, etc

 its submitted as another patchset, jenkins builds again for that change in commit msg (which is totally unnecessary since there's no code change) and then the change is getting merged.

Questions:
1. Is there a way Gerrit to auto adds the reviewers at the end before merging, so they dont have to edit the commit message and submit again?
2. Also, Is there atleast a way in gerrit trigger plugin to let Jenkins know where we can specify "if there are no diffs builds dont have to be triggered"

Appreciate your help on this.

Thanks,
Cdev

Edwin Kempin

unread,
Apr 8, 2014, 3:21:57 AM4/8/14
to C dev, Repo and Gerrit Discussion
2014-04-08 9:05 GMT+02:00 C dev <cdev0...@gmail.com>:
Hi 

Currently we have a workflow 
as when a developer commits Jenkins is triggered for that patchset thro Gerrit trigger plugin and reports back +1 verified,
In the meanwhile a reviewer does the code review +2 ,
Once both are done the author then adds the reviewers to the reviewed by field to the commit message and submits it for a merge. (when submitting a patch set the reviewers are not aware of who's going to be reviewing their code, hence they add it at the end of the process before merging)

here's the problem so when he submits his change for merge he edits the commit message like below,
eg: 

Bug ID:ABCde12345 Test commit
Change-Id: I347ecgcfaf5g0g267dg008f3gb590b8e9eb6e3d4
Reviewed-By:John Doe, James, etc

 its submitted as another patchset, jenkins builds again for that change in commit msg (which is totally unnecessary since there's no code change) and then the change is getting merged.

Questions:
1. Is there a way Gerrit to auto adds the reviewers at the end before merging, so they dont have to edit the commit message and submit again?
Just use the reviewnotes plugin [1]. It records the approvals on submit as a Git note on the merged commit. If you fetch the refs/notes/review branch you can then see the approvals in your local history, e.g.:

$ git log --show-notes=review
commit 6cb803b95935c65ac747431b83d37954e37fc521
Author: Dariusz Luksza <dar...@luksza.org>
Date:   Fri Apr 4 15:59:50 2014 +0200

    Don't allow empty user name and passwords in InternalAuthBackend

    Simple null check for username and password in InternalAuthBackend is
    not enough. Also empty usernames and passwords should not be allowed.

    Change-Id: I7ab1866b6b977db568c7fdec931cc5b96122f8c1
    Signed-off-by: Dariusz Luksza <dar...@luksza.org>

Notes (review):
    Code-Review+2: David Pursehouse <david.pu...@sonymobile.com>
    Verified+1: Dariusz Łuksza <dariusz...@gmail.com>
    Submitted-by: David Pursehouse <david.pu...@sonymobile.com>
    Submitted-at: Mon, 07 Apr 2014 13:54:05 +0000
    Reviewed-on: https://gerrit-review.googlesource.com/55746
    Project: gerrit
    Branch: refs/heads/master

There is no need to manually record the reviewers in the commit message.
 
2. Also, Is there atleast a way in gerrit trigger plugin to let Jenkins know where we can specify "if there are no diffs builds dont have to be triggered"

You could configure the 'Verified' label so that it's approvals are automatically copied to a new patch set if there was no code change, see [2]. From Jenkins it would be possible to check if the Verified vote is already there and to skip the build if yes. But AFAIK the Gerrit Trigger Plugin can't do this yet. Also we might want to include the change kind (e.g. no code change, trivial rebase, rework) into the stream-events, but this is not done yet.

[2] https://gerrit-review.googlesource.com/Documentation/config-labels.html#label_copyAllScoresIfNoCodeChange
 

Appreciate your help on this.

Thanks,
Cdev

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

C dev

unread,
Apr 9, 2014, 2:14:12 AM4/9/14
to Edwin Kempin, Repo and Gerrit Discussion
Hi Edwin,

Thanks a lot for your immediate response.
Also thanks for directing me to [1]
for [2]..

I have edited my project.config file of a child project as 

[label "Verified"]
        function = MaxWithBlock
        value = -1 Fails
        value =  0 No score
        value = +1 Verified
        copyAllScoresIfNoCodeChange = true

Tried testing by submitting a patch set, jenkins triggered,
Changed just the commit msg, submitted again jenkins still triggered

Do i still have to change any configurations in jenkins to check if the verified vote is already there??[i checked in Jenkins but there doesnt seem to be any config regarding that! I already have the gerrit trigger configiurations for reporting too?? Could you please let me know on what I am missing here?


3. Is there a way to consolidate all the comments in a single page?
 why?? For eg: a developer submits a code and the reviewer has lots of comments on it and most of it would have been addressed and done, but everytime they have to go into each and every patchset to view all the comments.  
This is a good to have feature just wanted to know if there are some solutions that exists already  . Expand all, Collapse all in web GUI doesnt help much in showing the comments. It would be good if they have expand all comments section too, so they dont have to go in every single patch set and look into.


Thanks,
-Cdev

Edwin Kempin

unread,
Apr 9, 2014, 2:22:12 AM4/9/14
to C dev, Repo and Gerrit Discussion
2014-04-09 8:14 GMT+02:00 C dev <cdev0...@gmail.com>:
Hi Edwin,

Thanks a lot for your immediate response.
Also thanks for directing me to [1]
for [2]..

I have edited my project.config file of a child project as 

[label "Verified"]
        function = MaxWithBlock
        value = -1 Fails
        value =  0 No score
        value = +1 Verified
        copyAllScoresIfNoCodeChange = true

Tried testing by submitting a patch set, jenkins triggered,
Changed just the commit msg, submitted again jenkins still triggered

Do i still have to change any configurations in jenkins to check if the verified vote is already there??[i checked in Jenkins but there doesnt seem to be any config regarding that! I already have the gerrit trigger configiurations for reporting too?? Could you please let me know on what I am missing here?
This is what I meant by "But AFAIK the Gerrit Trigger Plugin can't do this yet." I don't think that the Gerrit Trigger Plugin has any support for this yet. I only was saying that it probably *could* be implemented in the Gerrit Trigger Plugin and this would get easier *if* Gerrit would include the change kind information into the stream-events. So there is no ready solution for this.
 


3. Is there a way to consolidate all the comments in a single page?
No, Gerrit doesn't have a screen that shows you all the comments of a change. The open issue 938 [1] may describe the feature that you are looking for.

[1] http://code.google.com/p/gerrit/issues/detail?id=938
Reply all
Reply to author
Forward
0 new messages