in templater/jobs/utils/utils.go [128:157]
func AddReleaseBranch(fileName string, data map[string]interface{}) map[string]map[string]interface{} {
jobList := map[string]map[string]interface{}{}
if !strings.Contains(fileName, "1-X") {
return jobList
}
currentReleaseBranches := releaseBranches
if strings.Contains(fileName, "kubernetes") && !strings.Contains(fileName, "release") {
currentReleaseBranches = append(k8releaseBranches, releaseBranches...)
}
for i, releaseBranch := range currentReleaseBranches {
releaseBranchBasedFileName := strings.ReplaceAll(fileName, "1-X", releaseBranch)
otherReleaseBranches := append(append([]string{}, currentReleaseBranches[:i]...),
currentReleaseBranches[i+1:]...)
jobList[releaseBranchBasedFileName] = AppendMap(data, map[string]interface{}{
"releaseBranch": releaseBranch,
"otherReleaseBranches": strings.Join(otherReleaseBranches, "|"),
})
// If latest release branch, check if the release branch dir exists before executing cmd
// This allows us to experiment with adding prow jobs for new branches without failing other runs
if len(currentReleaseBranches)-1 == i {
jobList[releaseBranchBasedFileName]["latestReleaseBranch"] = true
}
}
return jobList
}