diff --git a/pkg/config/job/presubmit.go b/pkg/config/job/presubmit.go index b8793932a..4d1b0efba 100644 --- a/pkg/config/job/presubmit.go +++ b/pkg/config/job/presubmit.go @@ -112,10 +112,12 @@ func (p Presubmit) ShouldRun(baseRef string, changes ChangedFilesProvider, force } // Evaluate regex expressions before checking if pre-submit jobs are always supposed to run - if determined, shouldRun, err := p.RegexpChangeMatcher.ShouldRun(changes); err != nil { - return false, err - } else if determined { - return shouldRun, nil + if !forced { + if determined, shouldRun, err := p.RegexpChangeMatcher.ShouldRun(changes); err != nil { + return false, err + } else if determined { + return shouldRun, nil + } } // TODO temporary disable RequireRun diff --git a/pkg/plugins/trigger/generic-comment_test.go b/pkg/plugins/trigger/generic-comment_test.go index 655a9aa09..cbc7e5a1f 100644 --- a/pkg/plugins/trigger/generic-comment_test.go +++ b/pkg/plugins/trigger/generic-comment_test.go @@ -709,7 +709,7 @@ func TestHandleGenericComment(t *testing.T) { name: "explicit /test for RunIfChanged job that doesn't need to run", Author: "trusted-member", - Body: "/test pull-jeb", + Body: "/test jeb", State: "open", IsPR: true, Presubmits: map[string][]job.Presubmit{ @@ -729,7 +729,7 @@ func TestHandleGenericComment(t *testing.T) { }, }, }, - ShouldBuild: false, + ShouldBuild: true, }, { name: "/test all of run_if_changed job that has passed and needs to run",