in templater/jobs/utils.go [51:74]
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
}
for i, releaseBranch := range releaseBranches {
releaseBranchBasedFileName := strings.ReplaceAll(fileName, "1-X", releaseBranch)
otherReleaseBranches := append(append([]string{}, releaseBranches[:i]...),
releaseBranches[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(releaseBranches)-1 == i {
jobList[releaseBranchBasedFileName]["latestReleaseBranch"] = true
}
}
return jobList
}