Prevent submitting "old" commits

45 views
Skip to first unread message

Aaron Beitch

unread,
Jul 2, 2018, 8:47:39 PM7/2/18
to Repo and Gerrit Discussion
Hello,

Our organization uses the "Rebase If Necessary" submit option because we have a large repository with several different teams working on different parts of the code base.

Occasionally the build gets broken by a commit being submitted that is no longer compatible with HEAD. We have found that most of the time this is caused by a review that hasn't been rebased recently. Could we prevent submit on a commit that hasn't been rebased in the past, for example, 4 days? Maybe through a plugin or submit rule?

Thanks,
Aaron

Saša Živkov

unread,
Jul 3, 2018, 3:51:51 AM7/3/18
to aar...@arista.com, Repo and Gerrit Discussion
Yes, you could implement a submit validator [1] in a plugin and perform the necessary checks there.



Thanks,
Aaron

--
--
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.
For more options, visit https://groups.google.com/d/optout.

Martin Fick

unread,
Jul 3, 2018, 3:08:08 PM7/3/18
to repo-d...@googlegroups.com, Aaron Beitch
On Monday, July 02, 2018 10:23:40 AM 'Aaron Beitch' via Repo
> <https://gerrit-review.googlesource.com/Documentation/prol
> og-cookbook.html>?

I would suggest performing CI on all changes in a serialized
fashion before submit. One way to do that is with the batch
plugin. This related thread is probably worth a read:

https://groups.google.com/forum/?hl=en#!searchin/repo-discuss/is$20Gerrit$20$27merge$20if$20necessary$27/repo-discuss/O2KIkHEoU38/OFnwBexyAQAJ

-Martin

--
The Qualcomm Innovation Center, Inc. is a member of Code
Aurora Forum, hosted by The Linux Foundation

Dave Borowitz

unread,
Jul 3, 2018, 4:20:06 PM7/3/18
to Martin Fick, repo-discuss, aar...@arista.com
You could also just change the submit strategy to Fast Forward Only. (Although for many teams this is too heavy-handed a policy to actually be useful.)

Aaron Beitch

unread,
Jul 3, 2018, 4:34:24 PM7/3/18
to dbor...@google.com, mf...@codeaurora.org, repo-d...@googlegroups.com
On Tue, Jul 3, 2018 at 1:19 PM Dave Borowitz <dbor...@google.com> wrote:
You could also just change the submit strategy to Fast Forward Only. (Although for many teams this is too heavy-handed a policy to actually be useful.)

That won't work at our scale.
 

On Tue, Jul 3, 2018 at 12:08 PM Martin Fick <mf...@codeaurora.org> wrote:
On Monday, July 02, 2018 10:23:40 AM 'Aaron Beitch' via Repo
and Gerrit Discussion wrote:
> Hello,
>
> Our organization uses the "Rebase If Necessary" submit
> option because we have a large repository with several
> different teams working on different parts of the code
> base.
>
> Occasionally the build gets broken by a commit being
> submitted that is no longer compatible with HEAD. We have
> found that most of the time this is caused by a review
> that hasn't been rebased recently. Could we prevent
> submit on a commit that hasn't been rebased in the past,
> for example, 4 days? Maybe through a plugin or submit
> rule
> <https://gerrit-review.googlesource.com/Documentation/prol
> og-cookbook.html>?

I would suggest performing CI on all changes in a serialized
fashion before submit.  One way to do that is with the batch
plugin.  This related thread is probably worth a read:

https://groups.google.com/forum/?hl=en#!searchin/repo-discuss/is$20Gerrit$20$27merge$20if$20necessary$27/repo-discuss/O2KIkHEoU38/OFnwBexyAQAJ 

Yeah, I'm familiar with that thread. I come from the same organization as Benoit Sigoure. I thought I had come up with a simple solution by looking for "old" commits.

Where can I find documentation or the code for the batch plugin? The repo for it appears to be empty: https://gerrit.googlesource.com/plugins/batch/

Thanks,
Aaron

Martin Fick

unread,
Jul 3, 2018, 4:49:02 PM7/3/18
to Aaron Beitch, dbor...@google.com, repo-d...@googlegroups.com
On Tuesday, July 03, 2018 01:34:08 PM Aaron Beitch wrote:
>
> Where can I find documentation or the code for the batch
> plugin? The repo for it appears to be empty:
> https://gerrit.googlesource.com/plugins/batch/

Unmerged code:

https://gerrit-review.googlesource.com/q/project:plugins%252Fbatch+branch:master+status:open

This is what we have ported so far from our internal code
which runs on our Gerrit 2.7 fork. Review and testing
encouraged, :) This series does not yet include a batch
"submit" because we have not ported that yet to upstream.
If you want, I could try to get an unported version pushed
upstream if you think you have time to port that piece?
Although "submit" will likely need to change significantly,
it probably isn't much code, you just point it to the new
code in Gerrit for merging code to a branch.

You can browse the docs on the latest change here:

https://gerrit.googlesource.com/plugins/batch/+/165d8363b5d1146544b06e84cfea8f7e942606e1/src/main/resources/Documentation

Jan Kundrát

unread,
Jul 4, 2018, 6:46:22 AM7/4/18
to repo-d...@googlegroups.com
On pondělí 2. července 2018 19:23:40 CEST, 'Aaron Beitch' via Repo and
Gerrit Discussion wrote:
> Occasionally the build gets broken by a commit being submitted that is no
> longer compatible with HEAD. We have found that most of the time this is
> caused by a review that hasn't been rebased recently.

This looks like a job for a CI system. You might want to take a look at
OpenStack's Zuul [1] and its "project gating" [2].

With kind regards,
Jan

[1] https://docs.openstack.org/infra/zuul/
[2] https://docs.openstack.org/infra/zuul/user/gating.html

--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
Reply all
Reply to author
Forward
0 new messages