How to disable Submit based on age of Verified label

58 views
Skip to first unread message

Clinton Wong

unread,
Aug 15, 2025, 12:25:15 PMAug 15
to Repo and Gerrit Discussion
I have been looking into a way to prevent the submission of a change if the Verified vote is older than 2 days.  
I added the following submit-requirement that sort of works:
    [submit-requirement "Verified Freshness"]
            description = Verified +1 on current patch set must be less than 2 days old.
            submittableIf = label:Verified=MAX AND -age:2d

With the addition of the submit-requirement, a change with with a preexisting Verified +1 vote and/or a Code-Review +2 vote can not be submitted if the Verified vote is older than 2 days.  However, if a person gives a new Code-Review +2, the submit-requirement is ignored.

Is there a way to make the age of the Verified vote take precedence?

Daniele Sassoli

unread,
Aug 18, 2025, 12:59:56 PMAug 18
to Repo and Gerrit Discussion
This is because the age predicate checks when the change was last updated, it's not tied with the Verified vote, despite the fact that reading it in the way you wrote it might make you think that.

AFAIK there is no builtin way to specify the time a specific label was last updated but you could probably write a custom submit requirement to do that.
Have a look  at how the owners plugin does that at [1]

[1] https://gerrit.googlesource.com/plugins/owners/+/refs/heads/master/owners/src/main/java/com/googlesource/gerrit/owners/OwnersApprovalHasOperand.java
Reply all
Reply to author
Forward
0 new messages