Skip to content

Commit

Permalink
readd test to fail, minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: schristoff <[email protected]>
  • Loading branch information
schristoff committed Sep 23, 2024
1 parent 14b6153 commit bc06308
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ var packageInspectCmd = &cobra.Command{
}
defer os.RemoveAll(pkgPaths.Base)

cluster, _ := cluster.NewCluster()
inspectOpt := packager2.ZarfInspectOptions{
PackagePaths: pkgPaths,
Cluster: cluster,
ListImages: pkgConfig.InspectOpts.ListImages,
ViewSBOM: pkgConfig.InspectOpts.ViewSBOM,
SBOMOutputDir: pkgConfig.InspectOpts.SBOMOutputDir,
Expand Down
12 changes: 5 additions & 7 deletions src/internal/packager2/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ import (
"github.com/defenseunicorns/pkg/helpers/v2"
"github.com/zarf-dev/zarf/src/api/v1alpha1"
"github.com/zarf-dev/zarf/src/internal/packager/sbom"
"github.com/zarf-dev/zarf/src/pkg/cluster"
"github.com/zarf-dev/zarf/src/pkg/layout"
)

// ZarfInspectOptions tracks the user-defined preferences during a package inspection.
type ZarfInspectOptions struct {
// PackagePaths
PackagePaths *layout.PackagePaths
// View SBOM contents while inspecting the package
ViewSBOM bool
// Location to output an SBOM into after package inspection
PackagePaths *layout.PackagePaths
Cluster *cluster.Cluster
ViewSBOM bool
SBOMOutputDir string
// ListImages will list the images in the package
ListImages bool
ListImages bool
}

// Inspect list the contents of a package.
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/packager/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (p *Packager) Inspect(ctx context.Context) error {
}
p.cfg.Pkg = pkg

if p.cfg.InspectOpts.ListImages && len(p.cfg.Pkg.Components) > 0 {
if p.cfg.InspectOpts.ListImages {
imageList := []string{}
for _, component := range p.cfg.Pkg.Components {
imageList = append(imageList, component.Images...)
Expand Down
5 changes: 5 additions & 0 deletions src/test/e2e/31_checksum_and_signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func TestChecksumAndSignature(t *testing.T) {
stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", pkgName, publicKeyFlag)
require.NoError(t, err, stdOut, stdErr)

/* Test operations during package inspect */
// Test that we can inspect the yaml of the package without the private key
stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", pkgName, "--insecure")
require.NoError(t, err, stdOut, stdErr)

/* Test operations during package deploy */
// Test that we get an error when trying to deploy a package without providing the public key
stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", pkgName, "--confirm")
Expand Down

0 comments on commit bc06308

Please sign in to comment.