sonyxperiadev / gerrit-events

MIT License
47 stars 62 forks source link

CommentAdded events considered equal even if they are different comments #90

Closed mtughan closed 3 years ago

mtughan commented 4 years ago

We are using the gerrit-trigger plugin as part of a setup at my company to trigger Jenkins builds on certain comments whenever a user would like additional builds performed on their change in Gerrit. For example, we should trigger build 1 when someone comments "requestBuild1" and build 2 when someone comments "requestBuild2". Build 1 sets a different label on the change than build 2 and so we do not want them merged (they have different "server" configurations to set the proper label). However, if a user comments "requestBuild1" and then immediately posts a separate comment with "requestBuild2", gerrit-trigger merges them together and the results of both will only be posted to 1 label.

The gerrit-trigger plugin should be smart enough to know that a comment added event on two different "servers", even if they point to the same Gerrit instance, should be handled separately. However, another issue that allows this is that the gerrit-events library's CommentAdded class considers 2 CommentAdded instances equal if the change and patchset of the two instances are the same, even if there were different comments that generated each one. CommentAdded events should be equal iff the change is the same, the patchset is the same, and the comment is the same.