prow/plugins/blockade/blockade.go
func compileApplicableBlockades(org, repo string, log *logrus.Entry, blockades []plugins.Blockade) []blockade {
	if len(blockades) == 0 {
		return nil
	}

	orgRepo := fmt.Sprintf("%s/%s", org, repo)
	var compiled []blockade
	for _, raw := range blockades {
		// Only consider blockades that apply to this repo.
		if !stringInSlice(org, raw.Repos) && !stringInSlice(orgRepo, raw.Repos) {
			continue
		}
		b := blockade{}
		for _, str := range raw.BlockRegexps {
			if reg, err := regexp.Compile(str); err != nil {
				log.WithError(err).Errorf("Failed to compile the blockade regexp '%s'.", str)
			} else {
				b.blockRegexps = append(b.blockRegexps, reg)
			}
		}
		if len(b.blockRegexps) == 0 {
			continue
		}
		if raw.Explanation == "" {
			b.explanation = "Files are protected"
		} else {
			b.explanation = raw.Explanation
		}
		for _, str := range raw.ExceptionRegexps {
			if reg, err := regexp.Compile(str); err != nil {
				log.WithError(err).Errorf("Failed to compile the blockade regexp '%s'.", str)
			} else {
				b.exceptionRegexps = append(b.exceptionRegexps, reg)
			}
		}
		compiled = append(compiled, b)
	}
	return compiled
}
func compileApplicableBlockades(org, repo string, log *logrus.Entry, blockades []plugins.Blockade) []blockade {
	if len(blockades) == 0 {
		return nil
	}

	orgRepo := fmt.Sprintf("%s/%s", org, repo)
	var compiled []blockade
	for _, raw := range blockades {
		// Only consider blockades that apply to this repo.
		if !stringInSlice(org, raw.Repos) && !stringInSlice(orgRepo, raw.Repos) {
			continue
		}
		b := blockade{}
		for _, str := range raw.BlockRegexps {
			if reg, err := regexp.Compile(str); err != nil {
				log.WithError(err).Errorf("Failed to compile the blockade regexp '%s'.", str)
			} else {
				b.blockRegexps = append(b.blockRegexps, reg)
			}
		}
		if len(b.blockRegexps) == 0 {
			continue
		}
		if raw.Explanation == "" {
			b.explanation = "Files are protected"
		} else {
			b.explanation = raw.Explanation
		}
		for _, str := range raw.ExceptionRegexps {
			if reg, err := regexp.Compile(str); err != nil {
				log.WithError(err).Errorf("Failed to compile the blockade regexp '%s'.", str)
			} else {
				b.exceptionRegexps = append(b.exceptionRegexps, reg)
			}
		}
		compiled = append(compiled, b)
	}
	return compiled
}
// compileApplicableBlockades filters the specified blockades and compiles those that apply to the repo.