get.porter.sh/porter@v1.3.0/pkg/cnab/provider/bundle.go (about) 1 package cnabprovider 2 3 import ( 4 "context" 5 "fmt" 6 7 "get.porter.sh/porter/pkg/cnab" 8 ) 9 10 func (r *Runtime) LoadBundle(bundleFile string) (cnab.ExtendedBundle, error) { 11 return cnab.LoadBundle(r.Context, bundleFile) 12 } 13 14 func (r *Runtime) ProcessBundleFromFile(ctx context.Context, bundleFile string) (cnab.ExtendedBundle, error) { 15 b, err := r.LoadBundle(bundleFile) 16 if err != nil { 17 return cnab.ExtendedBundle{}, err 18 } 19 20 return r.ProcessBundle(ctx, b) 21 } 22 23 func (r *Runtime) ProcessBundle(ctx context.Context, b cnab.ExtendedBundle) (cnab.ExtendedBundle, error) { 24 strategy := r.GetSchemaCheckStrategy(ctx) 25 err := b.Validate(r.Context, strategy) 26 if err != nil { 27 return b, fmt.Errorf("invalid bundle: %w", err) 28 } 29 30 return b, r.ProcessRequiredExtensions(b) 31 }