Skip to content

Commit

Permalink
fix: update the way results are retrieved for certified conformance
Browse files Browse the repository at this point in the history
Looks like we bumped sonobuoy library, and it silently changed a lot of
things in the way it works with the results.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Sep 13, 2021
1 parent a059454 commit a1c9d64
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pkg/cluster/sonobuoy/sonobuoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ func Run(ctx context.Context, cluster cluster.K8sProvider, options *Options) err
return fmt.Errorf("no result reader")
}

tarR := tar.NewReader(resultR)
gzipR, err := gzip.NewReader(resultR)
if err != nil {
return err
}

defer gzipR.Close() //nolint:errcheck

tarR := tar.NewReader(gzipR)

for {
var header *tar.Header
Expand All @@ -262,22 +269,22 @@ func Run(ctx context.Context, cluster cluster.K8sProvider, options *Options) err
return err
}

matched, _ := filepath.Match("tmp/sonobuoy/*_sonobuoy_*.tar.gz", header.Name) //nolint:errcheck
matched, _ := filepath.Match("*_sonobuoy_*.tar.gz", header.Name) //nolint:errcheck

if !matched {
continue
}

var gzipR *gzip.Reader
var innerGzipR *gzip.Reader

gzipR, err = gzip.NewReader(tarR)
innerGzipR, err = gzip.NewReader(tarR)
if err != nil {
return err
}

defer gzipR.Close() //nolint:errcheck
defer innerGzipR.Close() //nolint:errcheck

innnerTarR := tar.NewReader(gzipR)
innnerTarR := tar.NewReader(innerGzipR)

for {
header, err = innnerTarR.Next()
Expand Down Expand Up @@ -315,7 +322,9 @@ func Run(ctx context.Context, cluster cluster.K8sProvider, options *Options) err

select {
case err = <-errCh:
return err
if err != nil {
return err
}
default:
}

Expand Down

0 comments on commit a1c9d64

Please sign in to comment.