How to config 1+1=2 Code-Review with Submit Requirements?

294 views
Skip to first unread message

Richard Du

unread,
Jul 6, 2022, 10:41:24 AM7/6/22
to repo-d...@googlegroups.com
Hello,

We are trying to use the "Submit requirements" to implement "1+1=2", i.e. we expect the change can only be submitted when there are at least two +1 votes.

Here is the piece of project config:
============================
[submit-requirement "Code-Review"]
    submittableIf = label:Code-Review=+1,count>=2
============================

While, in the Gerrit UI, we saw two "Code-Review" in "Submit Requirements" section:
one's Status is SATISFIED , with "Submit condition:
label:Code-Review=+1,count>=2"

the other one's Status is *UNSATISFIED*, with "Submit condition:
label:Code-Review=MAX -label:Code-Review=MIN"

And the change could not be submitted.

So, any suggestions on how to achieve "1+1=2" with submit requirements?

Regards,
Richard

Nasser Grainawi

unread,
Jul 6, 2022, 5:54:52 PM7/6/22
to Richard Du, repo-d...@googlegroups.com
On Wed, Jul 6, 2022 at 8:41 AM Richard Du <dux...@gmail.com> wrote:
Hello,

We are trying to use the "Submit requirements" to implement "1+1=2", i.e. we expect the change can only be submitted when there are at least two +1 votes.

Here is the piece of project config:
============================
[submit-requirement "Code-Review"]
    submittableIf = label:Code-Review=+1,count>=2
============================

While, in the Gerrit UI, we saw two "Code-Review" in "Submit Requirements" section:
one's Status is SATISFIED , with "Submit condition:
label:Code-Review=+1,count>=2"

the other one's Status is *UNSATISFIED*, with "Submit condition:
label:Code-Review=MAX -label:Code-Review=MIN"

This one is coming from the label itself. I think you'll want to change the function [1] for the label to NoOp so that only the submit requirement is used.

 

And the change could not be submitted.

So, any suggestions on how to achieve "1+1=2" with submit requirements?

Regards,
Richard

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/CAH2vwOvMzN4brBfTxzu8vn-xbHOcRANt4SGHVnSCvdNiQVX38w%40mail.gmail.com.

Xiong Du

unread,
Jul 6, 2022, 9:28:03 PM7/6/22
to Repo and Gerrit Discussion
Thanks you for the sugguestion, it works now.

I copy the label.Code-Review from All-Project to project config, and change the function to NoOp, it works as expected.
=================================
[label "Code-Review"]
    function = NoOp
    copyMinScore = true
    value = -2 This shall not be merged
    value = -1 I would prefer this is not merged as is
    value = 0 No score
    value = +1 Looks good to me, but someone else must approve
    value = +2 Looks good to me, approved
    defaultValue = 0
[submit-requirement "Code-Review"]
    submittableIf = (label:Code-Review=+1,count>=2 OR label:Code-Review=MAX) AND -label:Code-Review=MIN
=================================

Reply all
Reply to author
Forward
0 new messages