Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/statusreconciler/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ func (c *Controller) triggerNewPresubmits(addedPresubmits map[string][]config.Pr
continue
}
for _, pr := range prs {
if pr.Draft {
continue
}
if pr.Mergable != nil && !*pr.Mergable {
// the PR cannot be merged as it is, so the user will need to update the PR (and trigger
// testing via the PR push event) or re-test if the HEAD of the branch they are targeting
Expand Down
44 changes: 44 additions & 0 deletions pkg/statusreconciler/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,25 @@ func TestControllerReconcile(t *testing.T) {
},
Mergable: &notMergable,
}
draftPr := github.PullRequest{
User: github.User{
Login: author,
},
Number: secondPrNumber,
Base: github.PullRequestBranch{
Repo: github.Repo{
Owner: github.User{
Login: org,
},
Name: repo,
},
Ref: baseRef,
},
Head: github.PullRequestBranch{
SHA: "prsha-draft",
},
Draft: true,
}
thirdPr := github.PullRequest{
User: github.User{
Login: author,
Expand Down Expand Up @@ -1057,6 +1076,31 @@ func TestControllerReconcile(t *testing.T) {
return controller, checker
},
},
{
name: "no errors and draft PR means we should see no trigger, a retire and a migrate",
generator: func() (Controller, func(*testing.T)) {
fpjt := newfakeProwJobTriggerer()
fghc := newFakeGitHubClient(orgRepoKey)
fghc.prs[orgRepoKey] = []github.PullRequest{draftPr}
fghc.refs[orgRepoKey]["heads/"+draftPr.Base.Ref] = baseSha
fsm := newFakeMigrator(orgRepoKey)
ftc := newFakeTrustedChecker(orgRepoKey)
ftc.trusted[orgRepoKey][secondPrAuthorKey] = true
controller := Controller{
continueOnError: true,
addedPresubmitDenylist: sets.New[string](),
prowJobTriggerer: &fpjt,
githubClient: &fghc,
statusMigrator: &fsm,
trustedChecker: &ftc,
}
checker := func(t *testing.T) {
checkTriggerer(t, fpjt, map[prKey]sets.Set[string]{})
checkMigrator(t, fsm, map[orgRepo]sets.Set[string]{orgRepoKey: sets.New[string]("required-job")}, map[orgRepo]migrationSet{orgRepoKey: {migrate: nil}})
}
return controller, checker
},
},
{
name: "no errors and PR that doesn't match the added job means we should see no trigger, a retire and a migrate",
generator: func() (Controller, func(*testing.T)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ in flight do not cause those PRs to get stuck.

When the set of blocking presubmits changes for a repository, one of three cases occurs:

- a new blocking presubmit exists and should be triggered for every trusted pull request in flight
- a new blocking presubmit exists and should be triggered for every trusted, non-draft pull request in flight
- an existing blocking presubmit is removed and should have its' status retired
- an existing blocking presubmit is renamed and should have its' status migrated

Expand Down