Bypass rule for administration group in rules.pl in gerrit configuration

流过昼夜 提交于 2019-12-11 15:09:28

问题


I'm not familiar with prolog language. I've used the example number 8 of the prolog cookbook.

https://gerrit-review.googlesource.com/Documentation/prolog-cookbook.html#_example_8_make_change_submittable_only_if_tt_code_review_2_tt_is_given_by_a_non_author

Which code is :

submit_filter(In,Out) :-
    In =.. [submit | Ls],
    add_non_author_approval(Ls, R),
    Out =.. [submit | R].

add_non_author_approval(S1, S2) :-
    gerrit:commit_author(A),
    gerrit:commit_label(label('Code-Review', 2), R),
    R \= A, !,
    S2 = [label('Non-Author-Code-Review', ok(R)) | S1].

add_non_author_approval(S1, [label('Non-Author-Code-Review', need(_)) | S1]).

This is the rule forcing a non author code review the code before submit.

It's working as intended, but I wanted users from admin group to bypass this rule(If they are author and the +2 reviewer the submit should always be enable).

Any kind of help is appreciated.

来源:https://stackoverflow.com/questions/57622412/bypass-rule-for-administration-group-in-rules-pl-in-gerrit-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!