Handle jobs without test groups (presubmit jobs) better.
@@ -73,6 +73,20 @@ func applySingleProwjobAnnotations(c *Config, pc *prowConfig.Config, j prowConfi
ReconcileTestGroup(testGroup, c.defaultConfig.DefaultTestGroup)
c.config.TestGroups = append(c.config.TestGroups, testGroup)
}
+ } else {
+ testGroup = c.config.FindTestGroup(testGroupName)
+ }
+
+ if testGroup == nil {
+ for _, a := range []string{testgridNumColumnsRecentAnnotation, testgridAlertStaleResultsHoursAnnotation,
+ testgridNumFailuresToAlertAnnotation, testgridTabNameAnnotation, testgridEmailAnnotation} {
+ _, ok := j.Annotations[a]
+ if ok {
+ return fmt.Errorf("no testgroup exists for job %q, but annotation %q implies one should exist", j.Name, a)
+ }
+ }
+ // exit early: with no test group, there's nothing else for us to usefully do with the job.
+ return nil
}
if ncr, ok := j.Annotations[testgridNumColumnsRecentAnnotation]; ok {
