DevDeploy creates + deploys a package in one shot
(ctx context.Context, packagePath string, opts DevDeployOptions)
| 55 | |
| 56 | // DevDeploy creates + deploys a package in one shot |
| 57 | func DevDeploy(ctx context.Context, packagePath string, opts DevDeployOptions) (err error) { |
| 58 | l := logger.From(ctx) |
| 59 | start := time.Now() |
| 60 | |
| 61 | if opts.Retries == 0 { |
| 62 | opts.Retries = config.ZarfDefaultRetries |
| 63 | } |
| 64 | if opts.Timeout == 0 { |
| 65 | opts.Timeout = config.ZarfDefaultTimeout |
| 66 | } |
| 67 | |
| 68 | opts.CachePath, err = utils.ResolveCachePath(opts.CachePath) |
| 69 | if err != nil { |
| 70 | return err |
| 71 | } |
| 72 | |
| 73 | loadOpts := load.DefinitionOptions{ |
| 74 | Flavor: opts.Flavor, |
| 75 | SetVariables: opts.CreateSetVariables, |
| 76 | CachePath: opts.CachePath, |
| 77 | IsInteractive: false, |
| 78 | SkipVersionCheck: opts.SkipVersionCheck, |
| 79 | RemoteOptions: opts.RemoteOptions, |
| 80 | } |
| 81 | defined, err := load.PackageDefinition(ctx, packagePath, loadOpts) |
| 82 | if err != nil { |
| 83 | return err |
| 84 | } |
| 85 | |
| 86 | filter := filters.Combine( |
| 87 | filters.ByLocalOS(runtime.GOOS), |
| 88 | filters.ForDeploy(opts.OptionalComponents, false), |
| 89 | ) |
| 90 | defined.Pkg.Components, err = filter.Apply(defined.Pkg) |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | // If not building for airgap, strip out all images and repos |
| 96 | if !opts.AirgapMode { |
| 97 | for idx := range defined.Pkg.Components { |
| 98 | defined.Pkg.Components[idx].Images = []string{} |
| 99 | defined.Pkg.Components[idx].ImageArchives = []v1alpha1.ImageArchive{} |
| 100 | defined.Pkg.Components[idx].Repos = []string{} |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | createOpts := layout.AssembleOptions{ |
| 105 | Flavor: opts.Flavor, |
| 106 | RegistryOverrides: opts.RegistryOverrides, |
| 107 | SkipSBOM: true, |
| 108 | OCIConcurrency: opts.OCIConcurrency, |
| 109 | CachePath: opts.CachePath, |
| 110 | } |
| 111 | pkgLayout, err := layout.AssemblePackage(ctx, defined.Pkg, packagePath, defined.ImportedSchemas, createOpts) |
| 112 | if err != nil { |
| 113 | return err |
| 114 | } |
no test coverage detected