prow/config/config.go
func (c *Config) finalizeJobConfig() error {
	if c.decorationRequested() {
		if c.Plank.DefaultDecorationConfig == nil {
			return errors.New("no default decoration config provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.UtilityImages == nil {
			return errors.New("no default decoration image pull specs provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.GCSConfiguration == nil {
			return errors.New("no default GCS decoration config provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.GCSCredentialsSecret == "" {
			return errors.New("no default GCS credentials secret provided for plank")
		}

		for _, vs := range c.Presubmits {
			for i := range vs {
				setPresubmitDecorationDefaults(c, &vs[i])
			}
		}

		for _, js := range c.Postsubmits {
			for i := range js {
				setPostsubmitDecorationDefaults(c, &js[i])
			}
		}

		for i := range c.Periodics {
			setPeriodicDecorationDefaults(c, &c.Periodics[i])
		}
	}

	// Ensure that regexes are valid and set defaults.
	for _, vs := range c.Presubmits {
		c.defaultPresubmitFields(vs)
		if err := SetPresubmitRegexes(vs); err != nil {
			return fmt.Errorf("could not set regex: %v", err)
		}
	}
	for _, js := range c.Postsubmits {
		c.defaultPostsubmitFields(js)
		if err := SetPostsubmitRegexes(js); err != nil {
			return fmt.Errorf("could not set regex: %v", err)
		}
	}

	c.defaultPeriodicFields(c.Periodics)

	for _, v := range c.AllPresubmits(nil) {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	for _, v := range c.AllPostsubmits(nil) {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	for _, v := range c.AllPeriodics() {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	return nil
}
func (c *Config) finalizeJobConfig() error {
	if c.decorationRequested() {
		if c.Plank.DefaultDecorationConfig == nil {
			return errors.New("no default decoration config provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.UtilityImages == nil {
			return errors.New("no default decoration image pull specs provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.GCSConfiguration == nil {
			return errors.New("no default GCS decoration config provided for plank")
		}
		if c.Plank.DefaultDecorationConfig.GCSCredentialsSecret == "" {
			return errors.New("no default GCS credentials secret provided for plank")
		}

		for _, vs := range c.Presubmits {
			for i := range vs {
				setPresubmitDecorationDefaults(c, &vs[i])
			}
		}

		for _, js := range c.Postsubmits {
			for i := range js {
				setPostsubmitDecorationDefaults(c, &js[i])
			}
		}

		for i := range c.Periodics {
			setPeriodicDecorationDefaults(c, &c.Periodics[i])
		}
	}

	// Ensure that regexes are valid and set defaults.
	for _, vs := range c.Presubmits {
		c.defaultPresubmitFields(vs)
		if err := SetPresubmitRegexes(vs); err != nil {
			return fmt.Errorf("could not set regex: %v", err)
		}
	}
	for _, js := range c.Postsubmits {
		c.defaultPostsubmitFields(js)
		if err := SetPostsubmitRegexes(js); err != nil {
			return fmt.Errorf("could not set regex: %v", err)
		}
	}

	c.defaultPeriodicFields(c.Periodics)

	for _, v := range c.AllPresubmits(nil) {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	for _, v := range c.AllPostsubmits(nil) {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	for _, v := range c.AllPeriodics() {
		if err := resolvePresets(v.Name, v.Labels, v.Spec, v.BuildSpec, c.Presets); err != nil {
			return err
		}
	}

	return nil
}
func ( c * Config ) finalizeJobConfig ( ) error { if c . decorationRequested ( ) { if c . Plank . DefaultDecorationConfig == nil { return errors . New ( " " ) } if c . Plank . DefaultDecorationConfig . UtilityImages == nil { return errors . New ( " " ) } if c . Plank . DefaultDecorationConfig . GCSConfiguration == nil { return errors . New ( " " ) } if c . Plank . DefaultDecorationConfig . GCSCredentialsSecret == " " { return errors . New ( " " ) } for _ , vs := range c . Presubmits { for i := range vs { setPresubmitDecorationDefaults ( c , & vs [ i ] ) } } for _ , js := range c . Postsubmits { for i := range js { setPostsubmitDecorationDefaults ( c , & js [ i ] ) } } for i := range c . Periodics { setPeriodicDecorationDefaults ( c , & c . Periodics [ i ] ) } } // Ensure that regexes are valid and set defaults. for _ , vs := range c . Presubmits { c . defaultPresubmitFields ( vs ) if err := SetPresubmitRegexes ( vs ) ; err != nil { return fmt . Errorf ( " " , err ) } } for _ , js := range c . Postsubmits { c . defaultPostsubmitFields ( js ) if err := SetPostsubmitRegexes ( js ) ; err != nil { return fmt . Errorf ( " " , err ) } } c . defaultPeriodicFields ( c . Periodics ) for _ , v := range c . AllPresubmits ( nil ) { if err := resolvePresets ( v . Name , v . Labels , v . Spec , v . BuildSpec , c . Presets ) ; err != nil { return err } } for _ , v := range c . AllPostsubmits ( nil ) { if err := resolvePresets ( v . Name , v . Labels , v . Spec , v . BuildSpec , c . Presets ) ; err != nil { return err } } for _ , v := range c . AllPeriodics ( ) { if err := resolvePresets ( v . Name , v . Labels , v . Spec , v . BuildSpec , c . Presets ) ; err != nil { return err } } return nil }
// finalizeJobConfig mutates and fixes entries for jobspecs
finalizeJobConfig mutates and fixes entries for jobspecs