func verifyDockerfiles()

in versioning/scripts/dockerfiles/main.go [139:179]


func verifyDockerfiles(version versions.Version, templateDir string, tmpl template.Template) (failureCount int) {
	foundDockerfile := make(map[string]bool)
	failureCount = 0
	warningCount := 0

	data := renderDockerfile(version, tmpl)

	path := filepath.Join(version.Dir, "Dockerfile")

	dockerfile, err := ioutil.ReadFile(path)
	check(err)

	foundDockerfile[path] = true

	if string(dockerfile) == string(data) {
		log.Printf("%s: OK", path)
	} else {
		failureCount++
		log.Printf("%s: FAILED", path)
	}

	err = filepath.Walk(templateDir, func(path string, info os.FileInfo, err error) error {
		check(err)
		if info.Name() == "Dockerfile" && !info.IsDir() && !foundDockerfile[path] {
			warningCount++
			log.Printf("%s: UNIDENTIFIED (warning)", path)
		}
		return nil
	})
	check(err)

	if failureCount == 0 && warningCount > 0 {
		log.Print("Dockerfile verification completed: PASSED (with warnings)")
	} else if failureCount == 0 {
		log.Print("Dockerfile verification completed: PASSED")
	} else {
		log.Print("Dockerfile verification completed: FAILED")
	}

	return
}