-
Notifications
You must be signed in to change notification settings - Fork 98
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
Introduce an option to overwrite GitHub contexts of pending presubmit ProwJobs when merging batches in tide
#135
Introduce an option to overwrite GitHub contexts of pending presubmit ProwJobs when merging batches in tide
#135
Conversation
Welcome @oliver-goetz! |
Hi @oliver-goetz. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
pkg/tide/github.go
Outdated
|
||
for _, pj := range pjs { | ||
for _, pull := range pj.Spec.Refs.Pulls { | ||
if pr, found := prNums[pull.Number]; found && pr.HeadRefOID == pull.SHA { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to also consider the ref for the target branch? Could we have some race like:
- trigger presubmits on target ref A
- trigger batch for same
- push to PR
- trigger presubmits for target ref B
- presubmits publish pending statuses
- batch finishes
- this code runs, overwriting presubmits
- batch would have been cancelled by the new push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I see.
I restructured this function that it checks if all PRs of a batch job are valid before collecting it. The logic is similar to how batch PRs are accumulated (ref).
Now, the context of a batch job which contain invalid or missing PRs are not collected anymore.
/ok-to-test |
7a15b1f
to
8d7d484
Compare
@stevekuznetsov could you check this PR again please? 🙂 |
Now, any leftover test report comments will be deleted too, when the context was overwritten. It might happen when the batch jobs succeed and there is a failing test in the trigger PR, which is restarted fast enough while the batch job is still running. |
friendly reminder, please review this PR 😄 |
/cc |
ping 🔔 |
@@ -265,6 +270,17 @@ func (gi *GitHubProvider) mergePRs(sp subpool, prs []CodeReviewCommon, dontUpdat | |||
continue | |||
} | |||
|
|||
// Overwrite context of pending presubmit prow jobs if enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever plan to overwrite the context to something other than success? I would consider either make that explicit in the function name, or make it take in the override status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes sense to set the status to anything else than success in the tide context. I updated the name of the function.
prowJobsForPRs[pull.Number].successfulBatchJob[pj.Spec.Context] = pj | ||
} | ||
case prowapi.PresubmitJob: | ||
if jobState != pendingState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also want to override failed presubmit runs if the batch job finishes with success?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a presubmit run of a batch member fails, the batch jobs continue to run. However, the batch is removed from the merge pool, so it would never reach this point here.
@stevekuznetsov @petr-muller wanna skim through again as you are the original reviewers? |
26c1f27
to
bf0e9aa
Compare
Let's not block on me, I'll skim post-merge (eventually :D ) Thanks @krzyzacy for reviewing this one, it's great to see you back. And thanks @oliver-goetz for your submission and patience 🙇 /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: oliver-goetz, petr-muller The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #209
With this PR
tide
overwrites the context ofpending
ProwJobs when it merges a batch of PRs. It uses the status of the succeeded batch job with the same context. The feature is disabled by default and can be enabled viaoverwrite-pending-contexts
context option.When the context is overwritten,
tide
deletes any test report comments created by crier (ref) of this PR which might still exist. They contain previous failed runs of the contexts which have just been overwritten. It would be confusing to keep them in the PR.Before, Github branch-protection rules could prevent merging PRs from a batch (see kubernetes/test-infra#32097 for details).
When a PR is merged the ProwJobs which are still running are canceled automatically by trigger plugin of
hook
, so there is no need to cancel them intide
.This PR replaces kubernetes/test-infra#32416.