diff --git a/src/pkg/packager/common.go b/src/pkg/packager/common.go index 2adb24cc73..1d3c2f877a 100644 --- a/src/pkg/packager/common.go +++ b/src/pkg/packager/common.go @@ -94,10 +94,6 @@ func New(cfg *types.PackagerConfig, mods ...Modifier) (*Packager, error) { cfg.SetVariableMap = make(map[string]*types.ZarfSetVariable) } - if cfg.Pkg.Build.OCIImportedComponents == nil { - cfg.Pkg.Build.OCIImportedComponents = make(map[string]string) - } - var ( err error pkgr = &Packager{ diff --git a/src/pkg/packager/compose.go b/src/pkg/packager/compose.go index 3011a3167d..f4466f5ec5 100644 --- a/src/pkg/packager/compose.go +++ b/src/pkg/packager/compose.go @@ -31,12 +31,6 @@ func (p *Packager) composeComponents() error { } message.Debugf("%s", chain) - if chain.ContainsOCIImport() { - url, name := chain.OCIImportDefinition() - // Save all the OCI imported components into our build data - p.cfg.Pkg.Build.OCIImportedComponents[url] = name - } - // migrate any deprecated component configurations now warnings := chain.Migrate(p.cfg.Pkg.Build) p.warnings = append(p.warnings, warnings...) diff --git a/src/pkg/packager/composer/oci.go b/src/pkg/packager/composer/oci.go index afa8d2af9b..3cdafb51a8 100644 --- a/src/pkg/packager/composer/oci.go +++ b/src/pkg/packager/composer/oci.go @@ -40,14 +40,6 @@ func (ic *ImportChain) ContainsOCIImport() bool { return ic.tail.prev != nil && ic.tail.prev.Import.URL != "" } -// OCIImportDefinition returns the url and name of the remote import -func (ic *ImportChain) OCIImportDefinition() (string, string) { - if !ic.ContainsOCIImport() { - return "", "" - } - return ic.tail.prev.Import.URL, ic.tail.prev.ImportName() -} - func (ic *ImportChain) fetchOCISkeleton() error { if !ic.ContainsOCIImport() { return nil diff --git a/src/pkg/packager/create.go b/src/pkg/packager/create.go index 064dd76a74..2b7a70d8b8 100755 --- a/src/pkg/packager/create.go +++ b/src/pkg/packager/create.go @@ -58,11 +58,6 @@ func (p *Packager) Create() (err error) { p.cfg.Pkg.Metadata.Version = config.CLIVersion } - // Before we compose the components (and render the imported OCI components), we need to remove any components that are not needed for a differential build - if err := p.removeDifferentialComponentsFromPackage(); err != nil { - return err - } - // Compose components into a single zarf.yaml file if err := p.composeComponents(); err != nil { return err @@ -667,44 +662,6 @@ func (p *Packager) loadDifferentialData() error { p.cfg.CreateOpts.DifferentialData.DifferentialImages = allIncludedImagesMap p.cfg.CreateOpts.DifferentialData.DifferentialRepos = allIncludedReposMap p.cfg.CreateOpts.DifferentialData.DifferentialPackageVersion = differentialZarfConfig.Metadata.Version - p.cfg.CreateOpts.DifferentialData.DifferentialOCIComponents = differentialZarfConfig.Build.OCIImportedComponents - - return nil -} - -// removeDifferentialComponentsFromPackage will remove unchanged OCI imported components from a differential package creation -func (p *Packager) removeDifferentialComponentsFromPackage() error { - // Remove components that were imported and already built into the reference package - if len(p.cfg.CreateOpts.DifferentialData.DifferentialOCIComponents) > 0 { - componentsToRemove := []int{} - - for idx, component := range p.cfg.Pkg.Components { - // if the component is imported from an OCI package and everything is the same, don't include this package - if helpers.IsOCIURL(component.Import.URL) { - if _, alsoExists := p.cfg.CreateOpts.DifferentialData.DifferentialOCIComponents[component.Import.URL]; alsoExists { - - // If the component spec is not empty, we will still include it in the differential package - // NOTE: We are ignoring fields that are not relevant to the differential build - if component.IsEmpty([]string{"Name", "Required", "Description", "Default", "Import"}) { - componentsToRemove = append(componentsToRemove, idx) - } - } - } - } - - // Remove the components that are already included (via OCI Import) in the reference package - if len(componentsToRemove) > 0 { - for i, componentIndex := range componentsToRemove { - indexToRemove := componentIndex - i - componentToRemove := p.cfg.Pkg.Components[indexToRemove] - - // If we are removing a component, add it to the build metadata and remove it from the list of OCI components for this package - p.cfg.Pkg.Build.DifferentialMissing = append(p.cfg.Pkg.Build.DifferentialMissing, componentToRemove.Name) - - p.cfg.Pkg.Components = append(p.cfg.Pkg.Components[:indexToRemove], p.cfg.Pkg.Components[indexToRemove+1:]...) - } - } - } return nil } diff --git a/src/test/e2e/52_oci_compose_differential_test.go b/src/test/e2e/52_oci_compose_differential_test.go index 78f6c815a8..5404fed7e5 100644 --- a/src/test/e2e/52_oci_compose_differential_test.go +++ b/src/test/e2e/52_oci_compose_differential_test.go @@ -92,8 +92,6 @@ func (suite *OCIDifferentialSuite) Test_0_Create_Differential_OCI() { // Check the metadata and build data for the normal package suite.Equal(normalZarfConfig.Metadata.Version, "v0.24.0") suite.False(normalZarfConfig.Build.Differential) - suite.Len(normalZarfConfig.Build.OCIImportedComponents, 1) - suite.Equal(normalZarfConfig.Build.OCIImportedComponents["oci://127.0.0.1:555/helm-charts:0.0.1-skeleton"], "demo-helm-oci-chart") // Check the component data for the normal package suite.Len(normalZarfConfig.Components, 3) @@ -111,7 +109,6 @@ func (suite *OCIDifferentialSuite) Test_0_Create_Differential_OCI() { suite.True(differentialZarfConfig.Build.Differential) suite.Len(differentialZarfConfig.Build.DifferentialMissing, 1) suite.Equal(differentialZarfConfig.Build.DifferentialMissing[0], "demo-helm-oci-chart") - suite.Len(differentialZarfConfig.Build.OCIImportedComponents, 0) // Check the component data for the differential package suite.Len(differentialZarfConfig.Components, 2) diff --git a/src/types/package.go b/src/types/package.go index b089081a82..6b44fe8a16 100644 --- a/src/types/package.go +++ b/src/types/package.go @@ -52,7 +52,6 @@ type ZarfBuildData struct { Differential bool `json:"differential,omitempty" jsonschema:"description=Whether this package was created with differential components"` RegistryOverrides map[string]string `json:"registryOverrides,omitempty" jsonschema:"description=Any registry domains that were overridden on package create when pulling images"` DifferentialMissing []string `json:"differentialMissing,omitempty" jsonschema:"description=List of components that were not included in this package due to differential packaging"` - OCIImportedComponents map[string]string `json:"OCIImportedComponents,omitempty" jsonschema:"description=Map of components that were imported via OCI. The keys are OCI Package URLs and values are the component names"` LastNonBreakingVersion string `json:"lastNonBreakingVersion,omitempty" jsonschema:"description=The minimum version of Zarf that does not have breaking package structure changes"` } diff --git a/src/types/runtime.go b/src/types/runtime.go index 65c347b882..2a29484f19 100644 --- a/src/types/runtime.go +++ b/src/types/runtime.go @@ -127,5 +127,4 @@ type DifferentialData struct { DifferentialPackageVersion string DifferentialImages map[string]bool DifferentialRepos map[string]bool - DifferentialOCIComponents map[string]string }