Skip to content

Commit

Permalink
Merge branch 'main' into refactor/creator-normal
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinAbro321 authored Jan 8, 2025
2 parents e30e460 + dc395ff commit 4cec60d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
directories:
- "/"
- "/hack/schema"
schedule:
interval: daily
groups:
Expand Down
6 changes: 6 additions & 0 deletions src/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ func (o *PackageInspectOptions) PreRun(_ *cobra.Command, _ []string) {
// Run performs the execution of 'package inspect' sub-command.
func (o *PackageInspectOptions) Run(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

if pkgConfig.InspectOpts.ListImages && (pkgConfig.InspectOpts.SBOMOutputDir != "" || pkgConfig.InspectOpts.ViewSBOM) {
return fmt.Errorf("cannot use --sbom or --sbom-out and --list-images at the same time")
}

// NOTE(mkcp): Gets user input with message
src, err := choosePackage(ctx, args)
if err != nil {
Expand Down Expand Up @@ -404,6 +409,7 @@ func (o *PackageInspectOptions) Run(cmd *cobra.Command, args []string) error {
return err
}
}
return nil
}

output, err := packager2.Inspect(ctx, inspectOpt)
Expand Down
19 changes: 7 additions & 12 deletions src/internal/packager2/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,14 @@ func InspectList(ctx context.Context, opt ZarfInspectOptions) ([]string, error)
if err != nil {
return nil, err
}
// Only list images if we have components
if len(pkg.Components) > 0 {
for _, component := range pkg.Components {
imageList = append(imageList, component.Images...)
}
if len(imageList) > 0 {
imageList = helpers.Unique(imageList)
return imageList, nil
}
return nil, fmt.Errorf("failed listing images: list of images found in components: %d", len(imageList))
for _, component := range pkg.Components {
imageList = append(imageList, component.Images...)
}

return imageList, err
if imageList == nil {
return nil, fmt.Errorf("failed listing images: 0 images found in package")
}
imageList = helpers.Unique(imageList)
return imageList, nil
}

func getPackageMetadata(ctx context.Context, opt ZarfInspectOptions) (v1alpha1.ZarfPackage, error) {
Expand Down

0 comments on commit 4cec60d

Please sign in to comment.