func migratedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]presubmitMigration {
	migrated := map[string][]presubmitMigration{}

	for repo, oldPresubmits := range old {
		migrated[repo] = []presubmitMigration{}
		for _, newPresubmit := range new[repo] {
			if !newPresubmit.ContextRequired() {
				continue
			}
			for _, oldPresubmit := range oldPresubmits {
				if oldPresubmit.Context != newPresubmit.Context && oldPresubmit.Name == newPresubmit.Name {
					migrated[repo] = append(migrated[repo], presubmitMigration{from: oldPresubmit, to: newPresubmit})
					logrus.WithFields(logrus.Fields{
						"repo": repo,
						"name": oldPresubmit.Name,
						"from": oldPresubmit.Context,
						"to":   newPresubmit.Context,
					}).Debug("Identified a migrated blocking presubmit.")
				}
			}
		}
	}

	var numMigrated int
	for _, presubmits := range migrated {
		numMigrated += len(presubmits)
	}
	logrus.Infof("Identified %d migrated blocking presubmits.", numMigrated)
	return migrated
}
func migratedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]presubmitMigration {
	migrated := map[string][]presubmitMigration{}

	for repo, oldPresubmits := range old {
		migrated[repo] = []presubmitMigration{}
		for _, newPresubmit := range new[repo] {
			if !newPresubmit.ContextRequired() {
				continue
			}
			for _, oldPresubmit := range oldPresubmits {
				if oldPresubmit.Context != newPresubmit.Context && oldPresubmit.Name == newPresubmit.Name {
					migrated[repo] = append(migrated[repo], presubmitMigration{from: oldPresubmit, to: newPresubmit})
					logrus.WithFields(logrus.Fields{
						"repo": repo,
						"name": oldPresubmit.Name,
						"from": oldPresubmit.Context,
						"to":   newPresubmit.Context,
					}).Debug("Identified a migrated blocking presubmit.")
				}
			}
		}
	}

	var numMigrated int
	for _, presubmits := range migrated {
		numMigrated += len(presubmits)
	}
	logrus.Infof("Identified %d migrated blocking presubmits.", numMigrated)
	return migrated
}
func migratedBlockingPresubmits ( old , new map [ string ] [ ] config . Presubmit ) map [ string ] [ ] presubmitMigration { migrated := map [ string ] [ ] presubmitMigration { } for repo , oldPresubmits := range old { migrated [ repo ] = [ ] presubmitMigration { } for _ , newPresubmit := range new [ repo ] { if ! newPresubmit . ContextRequired ( ) { continue } for _ , oldPresubmit := range oldPresubmits { if oldPresubmit . Context != newPresubmit . Context && oldPresubmit . Name == newPresubmit . Name { migrated [ repo ] = append ( migrated [ repo ] , presubmitMigration { from : oldPresubmit , to : newPresubmit } ) logrus . WithFields ( logrus . Fields { " " : repo , " " : oldPresubmit . Name , " " : oldPresubmit . Context , " " : newPresubmit . Context , } ) . Debug ( " " ) } } } } var numMigrated int for _ , presubmits := range migrated { numMigrated += len ( presubmits ) } logrus . Infof ( " " , numMigrated ) return migrated }
// migratedBlockingPresubmits determines blocking presubmits that have had
// their status contexts migrated. This is a best-effort evaluation as we
// can only track a presubmit between configuration versions by its name.
// A presubmit "migration" that had its underlying job and context changed
// will be treated as a deletion and creation.
migratedBlockingPresubmits determines blocking presubmits that have had their status contexts migrated . This is a best - effort evaluation as we can only track a presubmit between configuration versions by its name . A presubmit migration that had its underlying job and context changed will be treated as a deletion and creation .