Page MenuHomePhabricator

GerritBot doesn't add #Patch-for-review to restored patches
Closed, ResolvedPublic

Description

When some patch gets abandoned the Patch-For-Review tag gets removed by @Maintenance_bot. When this patch now gets restored, @gerritbot doesn't add the Patch-For-Review tag back to the task. (e.g. T267447)

Event Timeline

hashar subscribed.

The implementation is the Gerrit plugin its-phabricator. The doc is at https://gerrit.wikimedia.org/r/plugins/its-phabricator/Documentation/index.html

The rules are defined in operations/puppet.git:

modules/gerrit/files/homedir/review_site/etc/its/actions.config
[rule "patchSetAbandoned"]
    event-type = change-abandoned
    association = subject,footer-Bug,footer-bug
    action = add-soy-comment PatchSetAbandoned

[rule "patchSetRestored"]
    event-type = change-restored
    association = subject,footer-Bug,footer-bug
    action = add-soy-comment PatchSetRestored

[rule "patchSetMerged"]
    event-type = change-merged
    association = subject,footer-Bug,footer-bug
    action = add-soy-comment PatchSetMerged

[rule "patchSetCreated"]
    event-type = patchset-created
    association = added@subject,added@footer-Bug,added@footer-bug
    action = add-soy-comment PatchSetCreated
    action = add-project Patch-For-Review     # <---------------------  add the project on patchset creation

The Gerrit plugin does trigger when a patch is restored:

Change 668479 restored by Zabe:
[mediawiki/skins/Timeless@master] BaseTemplate::getFooterIcons is deprecated

https://gerrit.wikimedia.org/r/668479

To add the project the actions are defined at https://gerrit.wikimedia.org/r/plugins/its-phabricator/Documentation/config-rulebase-plugin-actions.md

So we just have to add the add-project Patch-For-Review action in the patchSetRestored rule.

Change 674548 had a related patch set uploaded (by Hashar; owner: Hashar):
[operations/puppet@production] gerrit: restoring a change adds Patch-For-Review

https://gerrit.wikimedia.org/r/674548

Change 674548 merged by Dzahn:
[operations/puppet@production] gerrit: restoring a change adds Patch-For-Review

https://gerrit.wikimedia.org/r/674548

Change 675091 had a related patch set uploaded (by Hashar; author: Hashar):
[test/gerrit-ping@master] its-pharbricator adds Patch-For-Review on restore

https://gerrit.wikimedia.org/r/675091

Change 675091 abandoned by Hashar:
[test/gerrit-ping@master] its-pharbricator adds Patch-For-Review on restore

Reason:

https://gerrit.wikimedia.org/r/675091

Change 675091 restored by Hashar:
[test/gerrit-ping@master] its-pharbricator adds Patch-For-Review on restore

https://gerrit.wikimedia.org/r/675091

Change 675091 abandoned by Hashar:
[test/gerrit-ping@master] its-pharbricator adds Patch-For-Review on restore

Reason:
it worked

https://gerrit.wikimedia.org/r/675091

The rule works, when restoring a patch Patch-For-Review is now added :]

gerrit_restore_patch_for_review.png (268×771 px, 40 KB)