in scripts/lint_prowjobs/main.go [145:158]
func MakeTargetCheck(jc *JobConstants) presubmitCheck {
return presubmitCheck(func(presubmitConfig config.Presubmit, fileContentsString string) (bool, int, string) {
if strings.Contains(presubmitConfig.JobBase.Name, "e2e") || strings.Contains(presubmitConfig.JobBase.Name, "lint") || strings.Contains(presubmitConfig.JobBase.Name, "mocks") || presubmitConfig.JobBase.Name == "eks-anywhere-attribution-files-presubmit" || presubmitConfig.JobBase.Name == "eks-anywhere-cluster-controller-tooling-presubmit" || presubmitConfig.JobBase.Name == "eks-anywhere-release-tooling-presubmit" {
return true, 0, ""
}
jobMakeTargetMatches := regexp.MustCompile(`make (\w+[-\w]+?).*`).FindStringSubmatch(strings.Join(presubmitConfig.JobBase.Spec.Containers[0].Command, " "))
jobMakeTarget := jobMakeTargetMatches[len(jobMakeTargetMatches)-1]
makeCommandLineNo := findLineNumber(fileContentsString, "make")
if jobMakeTarget != jc.DefaultMakeTarget {
return false, makeCommandLineNo, fmt.Sprintf(`Invalid make target, please use the "%s" target`, jc.DefaultMakeTarget)
}
return true, 0, ""
})
}