in tools/dockerversioning/scripts/cloudbuild/main.go [389:419]
func main() {
config := versions.LoadConfig("versions.yaml", "cloudbuild")
registryPtr := config.StringOption("registry", "gcr.io/$PROJECT_ID", "Registry, e.g: 'gcr.io/my-project'")
dirsPtr := config.StringOption("dirs", "", "Comma separated list of Dockerfile dirs to use.")
testsPtr := config.BoolOption("tests", true, "Run tests.")
newTagsPtr := config.BoolOption("new_tags", false, "Require that image tags do not already exist.")
firstTagOnly := config.BoolOption("first_tag", false, "Build only the first per version.")
timeoutPtr := config.IntOption("timeout", 0, "Timeout in seconds. If not set, the default Cloud Build timeout is used.")
machineTypePtr := config.StringOption("machineType","", "Optional machine type used to run the build, , must be one of: N1_HIGHCPU_8, N1_HIGHCPU_32, E2_HIGHCPU_8, E2_HIGHCPU_32. If not specified, the default machine is used.")
enableParallel := config.BoolOption("enable_parallel", false, "Enable parallel build and bigger VM")
forceParallel := config.BoolOption("force_parallel", false, "Force parallel build and bigger VM")
dockerImage := config.StringOption("docker_image", "gcr.io/cloud-builders/docker", "Optional docker builder reference")
config.Parse()
if *registryPtr == "" {
log.Fatalf("--registry flag is required")
}
if strings.Contains(*registryPtr, ":") {
*registryPtr = strings.Replace(*registryPtr, ":", "/", 1)
}
var dirs []string
if *dirsPtr != "" {
dirs = strings.Split(*dirsPtr, ",")
}
spec := versions.LoadVersions("versions.yaml")
options := cloudBuildOptions{dirs, *testsPtr, *newTagsPtr, *firstTagOnly, *timeoutPtr, *machineTypePtr, *enableParallel, *forceParallel, *dockerImage}
result := renderCloudBuildConfig(*registryPtr, spec, options)
fmt.Println(result)
}