Skip to content

statusreconciler: skip draft PRs in triggerNewPresubmits#699

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
carterpewpew:fix/85b0a7902fd6
May 4, 2026
Merged

statusreconciler: skip draft PRs in triggerNewPresubmits#699
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
carterpewpew:fix/85b0a7902fd6

Conversation

@carterpewpew
Copy link
Copy Markdown
Contributor

@carterpewpew carterpewpew commented Apr 30, 2026

GetPullRequests returns all open PRs, including drafts. In status-reconciler, triggerNewPresubmits iterated all open PRs and called RunRequested directly, so trusted draft PRs could receive newly-added blocking presubmits during config reconciliation.

The trigger plugin already skips drafts via buildAllButDrafts, but status-reconciler bypassed that path. This change adds the same draft guard in triggerNewPresubmits (before the existing mergeable check) so drafts are skipped early. Non-draft behavior is unchanged.

Retire and migrate operations are intentionally unchanged: they continue to apply to all PRs (including drafts) because status contexts still need cleanup/migration.

Test follows the existing unmergable-PR pattern and verifies draft PRs are not triggered.

Fixes: #190

GetPullRequests includes draft PRs, so status-reconciler could create newly-required presubmits for draft PRs during config reconciliation. Skip drafts in this path and document that new blocking presubmits are triggered only for trusted non-draft PRs.

Signed-off-by: Jathavedhan M <jathavedhan.m@ibm.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 79ed8a4
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/69f2f89ed7253900096c4a7c
😎 Deploy Preview https://deploy-preview-699--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 project configuration.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/documentation Issues or PRs related to documentation labels Apr 30, 2026
@k8s-ci-robot k8s-ci-robot added the area/status-reconciler Issues or PRs related to reconciling status when jobs change label Apr 30, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @carterpewpew!

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 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 30, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @carterpewpew. 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.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 30, 2026
@Prucek
Copy link
Copy Markdown
Member

Prucek commented Apr 30, 2026

So, with this PR, you are trying to ensure that the PR's presubmit contexts aren't created on a draft PR?
Here we have a draft PR: openshift/ci-tools#5030, no presubmit is triggered.

@carterpewpew
Copy link
Copy Markdown
Contributor Author

So, with this PR, you are trying to ensure that the PR's presubmit contexts aren't created on a draft PR? Here we have a draft PR: openshift/ci-tools#5030, no presubmit is triggered.

Thank you @Prucek for taking a look, The example you linked is the trigger plugin correctly skipping CI on a draft PR push that path already handles drafts. This fix is for a different code path: when a new blocking presubmit is added to the config, the status-reconciler's triggerNewPresubmits queries all open PRs via GetPullRequests (which includes drafts) and triggers the new job for them. That reconciliation path didn't have a draft check before this.

@petr-muller
Copy link
Copy Markdown
Contributor

/test all

@petr-muller
Copy link
Copy Markdown
Contributor

petr-muller commented May 1, 2026

@Prucek there's #190 filed for the problem. presubmits do not trigger on draft PRs, but when status-reconciler triggers new jobs it does so even on draft PRs which is inconsistent and wasteful. I'll /approve and leave lgtm on you.

@carterpewpew can you add Fixes: #190 to your description?

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carterpewpew, petr-muller

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

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2026
@carterpewpew
Copy link
Copy Markdown
Contributor Author

@Prucek there's #190 filed for the problem. presubmits do not trigger on draft PRs, but when status-reconciler triggers new jobs it does so even on draft PRs which is inconsistent and wasteful. I'll /approve and leave lgtm on you.

@carterpewpew can you add Fixes: #190 to your description?

/approve

Done, thanks again

Copy link
Copy Markdown
Member

@Prucek Prucek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2026
@k8s-ci-robot k8s-ci-robot merged commit 1c1101c into kubernetes-sigs:main May 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/documentation Issues or PRs related to documentation area/status-reconciler Issues or PRs related to reconciling status when jobs change cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a presubmit job triggered builds on draft pull requests

4 participants