github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/v7pushaction/handle_docker_image_override.go (about) 1 package v7pushaction 2 3 import ( 4 "code.cloudfoundry.org/cli/command/translatableerror" 5 "code.cloudfoundry.org/cli/util/manifestparser" 6 ) 7 8 func HandleDockerImageOverride(manifest manifestparser.Manifest, overrides FlagOverrides) (manifestparser.Manifest, error) { 9 if overrides.DockerImage != "" { 10 if manifest.ContainsMultipleApps() { 11 return manifest, translatableerror.CommandLineArgsWithMultipleAppsError{} 12 } 13 14 app := manifest.GetFirstApp() 15 16 if app.HasBuildpacks() { 17 return manifest, translatableerror.ArgumentManifestMismatchError{ 18 Arg: "--docker-image, -o", 19 ManifestProperty: "buildpacks", 20 } 21 } 22 23 if app.Path != "" { 24 return manifest, translatableerror.ArgumentManifestMismatchError{ 25 Arg: "--docker-image, -o", 26 ManifestProperty: "path", 27 } 28 } 29 30 if app.Docker == nil { 31 emptyDockerInfo := manifestparser.Docker{} 32 app.Docker = &emptyDockerInfo 33 } 34 35 app.Docker.Image = overrides.DockerImage 36 } 37 38 return manifest, nil 39 }