in scripts/lint_prowjobs/main.go [79:95]
func EnvVarsCheck(jc *JobConstants) presubmitCheck {
return presubmitCheck(func(presubmitConfig config.Presubmit, fileContentsString string) (bool, int, string) {
for _, container := range presubmitConfig.JobBase.Spec.Containers {
for _, env := range container.Env {
if index, exists := jc.envVarExist(env.Name); exists {
// check deepequal in case we decide to support EnvVarSource values in the future
if env != jc.EnvVars[index] {
lineToFind := fmt.Sprintf("name: %s", env.Name)
correctiveAction := fmt.Sprintf("Incorrect env var declared for %s in the %s container, update it to %s", env.Name, container.Name, env)
return false, findLineNumber(fileContentsString, lineToFind), correctiveAction
}
}
}
}
return true, 0, ""
})
}