Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

oliver-goetz
Copy link
Contributor

Fixes kubernetes/test-infra#32097

With this PR tide overwrites the context of pending 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 via overwrite-pending-contexts context option.
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 in tide.

This PR replaces kubernetes/test-infra#32416.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: oliver-goetz
Once this PR has been reviewed and has the lgtm label, please assign cjwagner for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 25, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @oliver-goetz!

It looks like this is your first PR to kubernetes-sigs/prow 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/prow has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 25, 2024
Copy link

netlify bot commented Apr 25, 2024

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 8d7d484
🔍 Latest deploy log https://app.netlify.com/sites/k8s-prow/deploys/6644500ff925f60008d9f290
😎 Deploy Preview https://deploy-preview-135--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 25, 2024

for _, pj := range pjs {
for _, pull := range pj.Spec.Refs.Pulls {
if pr, found := prNums[pull.Number]; found && pr.HeadRefOID == pull.SHA {
Copy link
Contributor

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:

  1. trigger presubmits on target ref A
  2. trigger batch for same
  3. push to PR
  4. trigger presubmits for target ref B
  5. presubmits publish pending statuses
  6. batch finishes
  7. this code runs, overwriting presubmits
  8. batch would have been cancelled by the new push

Copy link
Contributor Author

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.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 2, 2024
@jihoon-seo
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 7, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 15, 2024
@oliver-goetz
Copy link
Contributor Author

@stevekuznetsov could you check this PR again please? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Branch protection rules prevent first PR of a merge-batch from being merged
4 participants