MCPcopy
hub / github.com/zarf-dev/zarf / DevDeploy

Function DevDeploy

src/pkg/packager/dev.go:57–180  ·  view source on GitHub ↗

DevDeploy creates + deploys a package in one shot

(ctx context.Context, packagePath string, opts DevDeployOptions)

Source from the content-addressed store, hash-verified

55
56// DevDeploy creates + deploys a package in one shot
57func 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 }

Callers 1

runMethod · 0.92

Calls 15

deployComponentsMethod · 0.95
FromFunction · 0.92
ResolveCachePathFunction · 0.92
PackageDefinitionFunction · 0.92
CombineFunction · 0.92
ByLocalOSFunction · 0.92
ForDeployFunction · 0.92
AssemblePackageFunction · 0.92
DefaultFunction · 0.92
NewWithWaitFunction · 0.92
CleanupMethod · 0.80

Tested by

no test coverage detected