Skip to content

Commit

Permalink
#208, #351. UPDATE packager/compose: added the shouldAddImportedPacka…
Browse files Browse the repository at this point in the history
…ge method when pulling in imported components. Updated shouldAddImportedPackage method to no longer prompt if --confirm flag is passed
  • Loading branch information
mike-winberry committed Mar 2, 2022
1 parent 9873c75 commit 47e5075
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli/internal/packager/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func GetComposedAssets() (components []types.ZarfComponent) {
for _, component := range config.GetComponents() {
// Build components list by expanding imported components.
if hasValidSubPackage(&component) {
if shouldAddImportedPackage(&component) {
importedComponents := getSubPackageAssets(component)
components = append(components, importedComponents...)

Expand All @@ -29,7 +29,7 @@ func GetComposedAssets() (components []types.ZarfComponent) {
func getSubPackageAssets(importComponent types.ZarfComponent) (components []types.ZarfComponent) {
importedPackage := getSubPackage(&importComponent)
for _, componentToCompose := range importedPackage.Components {
if hasValidSubPackage(&componentToCompose) {
if shouldAddImportedPackage(&componentToCompose) {
components = append(components, getSubPackageAssets(componentToCompose)...)
} else {
prepComponentToCompose(&componentToCompose, importedPackage.Metadata.Name, importComponent.Import.Path)
Expand All @@ -41,7 +41,7 @@ func getSubPackageAssets(importComponent types.ZarfComponent) (components []type

// Confirms inclusion of SubPackage. Need team input.
func shouldAddImportedPackage(component *types.ZarfComponent) bool {
return hasValidSubPackage(component) && (component.Required || ConfirmOptionalComponent(*component))
return hasValidSubPackage(component) && (config.DeployOptions.Confirm || component.Required || ConfirmOptionalComponent(*component))
}

// Validates the sub component, errors out if validation fails.
Expand Down

0 comments on commit 47e5075

Please sign in to comment.