-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gerrit: implement CL auto-submit #48021
Comments
Change https://golang.org/cl/341212 mentions this issue: |
Yeah, no need for extra restrictions, however I think that an explicit opt-in is good UX, so I'd take Russ's suggestion to make Gerrit clear AutoSubmit+1 on new patch sets. You should add an This also has a limited security advantage in that Gerrit (or GitHub via gerritbot) can be misconfigured to allow others to add a PS to someone's CL, and AutoSubmit should not carry across. |
If a CL has been labeled with "Auto-Submit", is submittable according to Gerrit, has a positive TryBot-Result vote, and has no unresolved comments then submit the change. This requires adding a new gerrit.Client method for the CL submission endpoint. Updates golang/go#48021 Change-Id: I3d5dafd1ca25a3cac5a40d7e9a744ba12ab44cae Reviewed-on: https://go-review.googlesource.com/c/build/+/341212 Trust: Roland Shoemaker <[email protected]> Run-TryBot: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
Change https://golang.org/cl/383174 mentions this issue: |
Also use this CL as a test run for golang/go#48021. Change-Id: I65cae5cab1713bb03122ac8137f3587d519375b4 Reviewed-on: https://go-review.googlesource.com/c/build/+/383174 Reviewed-by: Heschi Kreinick <[email protected]> Trust: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
I performed a controlled test run on https://go-review.googlesource.com/c/build/+/383174, watching it closely. There weren't any unexpected findings, everything worked as intended. Here's a log of events with some additional logging/information about decisions gopherbot took:
(Thanks @rolandshoemaker for coming up with the sample run sequence.) |
Change https://golang.org/cl/383274 mentions this issue: |
Run the Auto-Submit action alongside everything else now. Updates golang/go#48021 Change-Id: If7a109bfe0dc64e5b488713415193129e102640a Reviewed-on: https://go-review.googlesource.com/c/build/+/383274 Reviewed-by: Dmitri Shuralyov <[email protected]> Trust: Roland Shoemaker <[email protected]> Run-TryBot: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/386294 mentions this issue: |
The current logic to find if a CL has any unresolved threads is to iterate over all comments in chronological order, and use the resolved state of most recent comments to update the overall resolved state of the corresponding thread. Threads are identified by the ID of the root (earliest) comment whose InReplyTo field is zero. When determining the thread ID that a reply is associated with, it's important to follow the loop of InReplyTo pointers all way to the top of the thread. That is, if there's a thread with 3 comments in total: A ← B ← C (Where A is an initial comment, B is a reply to it, and C is a reply to B.) Then the resolved state of comment C needs to update the resolved state of thread A, even though comment C is a direct reply to comment B. The existing code worked for threads with depths 1 and 2, but not 3+. To handle threads with deeper nesting, add a 'roots' map that tracks the root ID for each comment seen during the chronological iteration. I thought this would apply to the equivalent logic in coordinator, and probably should have checked sooner, as then I'd find this was already implemented there in CL 317971. This change applies some comments and code style decisions from coordinator's listPatchSetThreads function so they're more in sync. For golang/go#48021. Change-Id: I93baff45aae511a60ccfce4e97b05d2a1b358e1f Reviewed-on: https://go-review.googlesource.com/c/build/+/386294 Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Trust: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/391734 mentions this issue: |
If a CL has the "wait-release" hashtag set, don't autosubmit it, since we are presumably in the freeze, and should wait for the tree to open. Updates golang/go#48021 Updates golang/go#24836 Change-Id: I23258ccbb71d2b8febe97ad8883b9fe9f90c761d Reviewed-on: https://go-review.googlesource.com/c/build/+/391734 Reviewed-by: Dmitri Shuralyov <[email protected]> Trust: Roland Shoemaker <[email protected]> Run-TryBot: Roland Shoemaker <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/396894 mentions this issue: |
Change https://go.dev/cl/406237 mentions this issue: |
When checking whether to autosubmit a change in a stack, ignore whether the revision of merged/abandoned parents are current (base revision == current revision). There are multiple reasons a merged parent may not be current (the most obvious being that the parent change was submitted, which increases the revision number, but the child was not rebased onto the new revision), but as long as the change is still considered 'submittable' by gerrit (i.e. there are no merge conflicts) this should not materially affect our decision of whether or not to submit the change (and matches what most users will do when manually submitting a stack). For golang/go#48021. Change-Id: Iceff8a88ac3638671f36175d802254788d2470fd Reviewed-on: https://go-review.googlesource.com/c/build/+/406237 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
Change https://go.dev/cl/431375 mentions this issue: |
Add a flag to set the Auto-Submit label. For golang/go#48021. Change-Id: If704e8b5e9e0e2521eed78fe28af10d3c31ec3a0 Reviewed-on: https://go-review.googlesource.com/c/review/+/431375 Auto-Submit: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Russ Cox <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]>
We've basically implemented everything described here, any follow-up work can now have it's own issue. 🎉 |
Change https://go.dev/cl/452135 mentions this issue: |
As of go.dev/issue/56031, the need to have passing TryBots and no unresolved comment threads is enforced by a submit requirement in Gerrit. The code in the auto-submit task is no longer load-bearing, so remove it to simplify and to avoid creating a false impression of it doing something important (beyond little differences, like handling the TryBot-Bypass label as implemented by the Gerrit submit rule, etc.). Running the "auto-submit CLs" task in dry-run mode did not report that it would submit any CLs. For golang/go#48021. Updates golang/go#56031. Change-Id: I09c6900199d26bd8e90fe7f7f681fd6227a762e8 Reviewed-on: https://go-review.googlesource.com/c/build/+/452135 Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]>
(similar to #12482, but this issue is intended to track the work of actually implementing and deploying this functionality)
Authors should be able to add a "Auto-Submit" label to CLs, such that once all submission requirements are met the CL is automatically submitted. The usage "Auto-Submit" label should be restricted to the existing 'approvers' Gerrit group.
The basic conditions for triggering auto-submit should be (the first two of these can be boiled down to 'submittable' according to Gerrit):
The one main open question is what restrictions should be in place around 'unreviewed' changes. Currently once a reviewer has +2'd a CL, if the author is in 'approvers' they can make changes to the CL before it is submitted (this is a common pattern, as reviewers will often +2 with small comments that the author should address before submitting). If we maintain the "Auto-Submit" label across patch sets, this behavior would essentially be maintained when using auto-submit functionality (since any comments would still need to be resolved, and a new TryBot-Result+1 would be required), although reviewers may be slightly less vigilante about looking at unreviewed changes which are submitted.
Since the author would still need to re-label with "Run-TryBot" after pushing a new patch set, it seems reasonable though to explicitly require them to also re-label with "Auto-Submit". This wouldn't really provide any extra security, but would make the author explicitly say they want their new patch set auto-submitted. Another approach would be to require there be no new patch set between the last Code-Review+2 and the auto-submit being triggered. This would explicitly require the reviewer to approve any changes since their last review, but doesn't necessarily add any additional security, since the author would still be able to manually submit their patch, and seems likely to just reduce the value of this feature.
I'm in favor of not implementing any additional restrictions, and simply saying if the change has Code-Review+2 and there are no unresolved comments (and all other submittability(?) requirements are satisfied), allowing follow-up unreviewed changes to be submitted. This would maintain the status-quo, relying on the assumption that members of the 'approvers' group should be generally trusted not to submit major unreviewed changes and that reviewers should be aware of what unreviewed changes were submitted (i.e. that there weren't changes outside of what they requested in the submitted CL).
There are two major components of this change:
cc @golang/release @golang/security
The text was updated successfully, but these errors were encountered: