Requiring a new validation when Gerrit performs a three way merge when "Allow content merges" is enabled

67 views
Skip to first unread message

Réda Housni Alaoui

unread,
Aug 3, 2018, 4:19:52 AM8/3/18
to Repo and Gerrit Discussion
Hi everyone,

5 Minutes ago, I discovered that I was bitten by "Allow content merges" option.
This option is enabled on all of our projects.
Each code review have to pass at least a Jenkins validation before being submitted. We use the Verified label for that.

Yesterday, I uploaded/submitted simultaneously 2 changes altering the same java file.
Before those changes, the file had an unused import that I'll call com.foo.Bar.

In change 1, I added line of code using com.foo.Bar.
In change 2, the import was automatically removed by my IDE.

Both changes passed the Jenkins validation, since each one compiles separately.
The changes were then merged in the same order (1 then 2) without any merge conflict.

The result is a master branch that does not compile anymore :(

I see 2 solutions to prevent this:
1- Disable "Allow content merges" which would lead to more manual work by the devs
2- Tell Gerrit to ask for a new validation when it performs content merges

Is there an existing option for solution 2?
Or could it be the subject of a feature request?

Best regards

Gert van Dijk

unread,
Aug 3, 2018, 4:31:13 AM8/3/18
to Repo and Gerrit Discussion


On Friday, 3 August 2018 10:19:52 UTC+2, Réda Housni Alaoui wrote:
Yesterday, I uploaded/submitted simultaneously 2 changes altering the same java file.
Before those changes, the file had an unused import that I'll call com.foo.Bar.

In change 1, I added line of code using com.foo.Bar.
In change 2, the import was automatically removed by my IDE.

Both changes passed the Jenkins validation, since each one compiles separately.
The changes were then merged in the same order (1 then 2) without any merge conflict.

The result is a master branch that does not compile anymore :(

I see 2 solutions to prevent this:
1- Disable "Allow content merges" which would lead to more manual work by the devs
2- Tell Gerrit to ask for a new validation when it performs content merges

Is there an existing option for solution 2?
Or could it be the subject of a feature request?

I believe an edit of the same file is not required to trigger this (depending on the project/language perhaps). Let's say you have change that renames a class in <dep.file> in change1 and you add a "from dep import myclass" in <other.file> in unrelated change2, you could break it too. Hence, allowing/disallowing content merges does not fully solve it.


Personally, I would put my bet on the unreleased 'batch' plugin that will solve this by the roots. :-)

HTH

Réda Housni Alaoui

unread,
Aug 3, 2018, 9:02:39 AM8/3/18
to Repo and Gerrit Discussion
Thank you Gert.
Can't wait for this batch plugin then :)

Jan Kundrát

unread,
Aug 3, 2018, 9:56:53 AM8/3/18
to repo-d...@googlegroups.com
You might want to check out Zuul and its gating:

https://zuul-ci.org/docs/zuul/user/gating.html

Cheers,
Jan

--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/

Jonathan Nieder

unread,
Aug 3, 2018, 11:12:16 AM8/3/18
to Jan Kundrát, repo-d...@googlegroups.com
See also the workflow using the Commit-Queue label that is used on https://chromium-review.googlesource.com/, for example. To get the property you're looking for, you'll need some mutual exclusion for submits, for example by using the "fast-forward only" merge strategy. This tends to work best if your CI is responsible for doing the final submit, since it can arrange for there to be no contention on submits.

Relevant bug in the bug tracker: https://crbug.com/gerrit/3751


Thanks and hope that helps,
Jonathan

Jan Kundrát wrote:
--
--
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.

MartinFick

unread,
Nov 16, 2018, 4:23:53 PM11/16/18
to Repo and Gerrit Discussion

On Friday, August 3, 2018 at 7:02:39 AM UTC-6, Réda Housni Alaoui wrote:
Thank you Gert.
Can't wait for this batch plugin then :)



-Martin


--

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

Reply all
Reply to author
Forward
0 new messages