Skip to content

Commit

Permalink
Merge pull request #24289 from petr-muller/method-to-finalize-periodic
Browse files Browse the repository at this point in the history
config: expose a new method to default a single input `Periodic`
  • Loading branch information
k8s-ci-robot authored Nov 10, 2021
2 parents e808b92 + 6714fd1 commit 3d6c14c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions prow/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1766,16 +1766,19 @@ func defaultPostsubmits(postsubmits []Postsubmit, additionalPresets []Preset, c
return utilerrors.NewAggregate(errs)
}

// DefaultPeriodic defaults (mutates) a single Periodic
func (c *Config) DefaultPeriodic(periodic *Periodic) error {
c.defaultPeriodicFields(periodic)
setPeriodicDecorationDefaults(c, periodic)
setPeriodicProwJobDefaults(c, periodic)
return resolvePresets(periodic.Name, periodic.Labels, periodic.Spec, c.Presets)
}

// defaultPeriodics defaults c.Periodics
func defaultPeriodics(c *Config) error {
c.defaultPeriodicFields(c.Periodics)
var errs []error
for i := range c.Periodics {
setPeriodicDecorationDefaults(c, &c.Periodics[i])
setPeriodicProwJobDefaults(c, &c.Periodics[i])
if err := resolvePresets(c.Periodics[i].Name, c.Periodics[i].Labels, c.Periodics[i].Spec, c.Presets); err != nil {
errs = append(errs, err)
}
errs = append(errs, c.DefaultPeriodic(&c.Periodics[i]))
}
return utilerrors.NewAggregate(errs)
}
Expand Down Expand Up @@ -2710,10 +2713,8 @@ func (c *ProwConfig) defaultPostsubmitFields(js []Postsubmit) {
}
}

func (c *ProwConfig) defaultPeriodicFields(js []Periodic) {
for i := range js {
c.defaultJobBase(&js[i].JobBase)
}
func (c *ProwConfig) defaultPeriodicFields(js *Periodic) {
c.defaultJobBase(&js.JobBase)
}

// SetPresubmitRegexes compiles and validates all the regular expressions for
Expand Down

0 comments on commit 3d6c14c

Please sign in to comment.