func (c *Config) mergeJobConfig(jc JobConfig) error {
	// Merge everything
	// *** Presets ***
	c.Presets = append(c.Presets, jc.Presets...)

	// validate no duplicated preset key-value pairs
	validLabels := map[string]bool{}
	for _, preset := range c.Presets {
		for label, val := range preset.Labels {
			pair := label + ":" + val
			if _, ok := validLabels[pair]; ok {
				return fmt.Errorf("duplicated preset 'label:value' pair : %s", pair)
			}
			validLabels[pair] = true
		}
	}

	// *** Periodics ***
	c.Periodics = append(c.Periodics, jc.Periodics...)

	// *** Presubmits ***
	if c.Presubmits == nil {
		c.Presubmits = make(map[string][]Presubmit)
	}
	for repo, jobs := range jc.Presubmits {
		c.Presubmits[repo] = append(c.Presubmits[repo], jobs...)
	}

	// *** Postsubmits ***
	if c.Postsubmits == nil {
		c.Postsubmits = make(map[string][]Postsubmit)
	}
	for repo, jobs := range jc.Postsubmits {
		c.Postsubmits[repo] = append(c.Postsubmits[repo], jobs...)
	}

	return nil
}
func (c *Config) mergeJobConfig(jc JobConfig) error {
	
	
	c.Presets = append(c.Presets, jc.Presets...)

	
	validLabels := map[string]bool{}
	for _, preset := range c.Presets {
		for label, val := range preset.Labels {
			pair := label + ":" + val
			if _, ok := validLabels[pair]; ok {
				return fmt.Errorf("duplicated preset 'label:value' pair : %s", pair)
			}
			validLabels[pair] = true
		}
	}

	
	c.Periodics = append(c.Periodics, jc.Periodics...)

	
	if c.Presubmits == nil {
		c.Presubmits = make(map[string][]Presubmit)
	}
	for repo, jobs := range jc.Presubmits {
		c.Presubmits[repo] = append(c.Presubmits[repo], jobs...)
	}

	
	if c.Postsubmits == nil {
		c.Postsubmits = make(map[string][]Postsubmit)
	}
	for repo, jobs := range jc.Postsubmits {
		c.Postsubmits[repo] = append(c.Postsubmits[repo], jobs...)
	}

	return nil
}
func ( c * Config ) mergeJobConfig ( jc JobConfig ) error { // Merge everything // *** Presets *** c . Presets = append ( c . Presets , jc . Presets ... ) // validate no duplicated preset key-value pairs validLabels := map [ string ] bool { } for _ , preset := range c . Presets { for label , val := range preset . Labels { pair := label + " " + val if _ , ok := validLabels [ pair ] ; ok { return fmt . Errorf ( " " , pair ) } validLabels [ pair ] = true } } // *** Periodics *** c . Periodics = append ( c . Periodics , jc . Periodics ... ) // *** Presubmits *** if c . Presubmits == nil { c . Presubmits = make ( map [ string ] [ ] Presubmit ) } for repo , jobs := range jc . Presubmits { c . Presubmits [ repo ] = append ( c . Presubmits [ repo ] , jobs ... ) } // *** Postsubmits *** if c . Postsubmits == nil { c . Postsubmits = make ( map [ string ] [ ] Postsubmit ) } for repo , jobs := range jc . Postsubmits { c . Postsubmits [ repo ] = append ( c . Postsubmits [ repo ] , jobs ... ) } return nil }
// mergeConfig merges two JobConfig together
// It will try to merge:
//	- Presubmits
//	- Postsubmits
// 	- Periodics
//	- PodPresets
mergeConfig merges two JobConfig together It will try to merge : - Presubmits - Postsubmits - Periodics - PodPresets