github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+incompatible/actor/v7pushaction/setup_all_resources_for_push_plan.go (about) 1 package v7pushaction 2 3 import ( 4 "code.cloudfoundry.org/cli/actor/sharedaction" 5 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" 6 "code.cloudfoundry.org/cli/util/manifestparser" 7 "errors" 8 "os" 9 ) 10 11 func (actor Actor) SetupAllResourcesForPushPlan(pushPlan PushPlan, overrides FlagOverrides, manifestApp manifestparser.Application) (PushPlan, error) { 12 if pushPlan.Application.LifecycleType == constant.AppLifecycleTypeDocker { 13 return pushPlan, nil 14 } 15 16 path := pushPlan.BitsPath 17 if path == "" { 18 return PushPlan{}, errors.New("developer error: Bits Path needs to be set prior to generating app resources") 19 } 20 21 info, err := os.Stat(path) 22 if err != nil { 23 return PushPlan{}, err 24 } 25 26 var archive bool 27 var resources []sharedaction.Resource 28 if info.IsDir() { 29 resources, err = actor.SharedActor.GatherDirectoryResources(path) 30 } else { 31 archive = true 32 resources, err = actor.SharedActor.GatherArchiveResources(path) 33 } 34 if err != nil { 35 return PushPlan{}, err 36 } 37 38 var v3Resources []sharedaction.V3Resource 39 for _, resource := range resources { 40 v3Resources = append(v3Resources, resource.ToV3Resource()) 41 } 42 43 pushPlan.Archive = archive 44 pushPlan.AllResources = v3Resources 45 46 return pushPlan, nil 47 }