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