Skip to content

Commit

Permalink
fix: surface errors when compressing files (#13491) (#13493)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
gcp-cherry-pick-bot[bot] and crenshaw-dev committed May 9, 2023
1 parent c8b4707 commit 6f5eaff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions util/cmp/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ func SendRepoStream(ctx context.Context, appPath, repoPath string, sender Stream
func GetCompressedRepoAndMetadata(repoPath string, appPath string, env []string, excludedGlobs []string, opt *senderOption) (*os.File, *pluginclient.AppStreamRequest, error) {
// compress all files in appPath in tgz
tgz, filesWritten, checksum, err := tgzstream.CompressFiles(repoPath, nil, excludedGlobs)
if filesWritten == 0 {
return nil, nil, fmt.Errorf("no files to send")
}
if err != nil {
return nil, nil, fmt.Errorf("error compressing repo files: %w", err)
}
if filesWritten == 0 {
return nil, nil, fmt.Errorf("no files to send")
}
if opt != nil && opt.tarDoneChan != nil {
opt.tarDoneChan <- true
close(opt.tarDoneChan)
Expand Down
6 changes: 3 additions & 3 deletions util/manifeststream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type RepoStreamReceiver interface {
// SendApplicationManifestQueryWithFiles compresses a folder and sends it over the stream
func SendApplicationManifestQueryWithFiles(ctx context.Context, stream ApplicationStreamSender, appName string, appNs string, dir string, inclusions []string) error {
f, filesWritten, checksum, err := tgzstream.CompressFiles(dir, inclusions, nil)
if filesWritten == 0 {
return fmt.Errorf("no files to send")
}
if err != nil {
return fmt.Errorf("failed to compress files: %w", err)
}
if filesWritten == 0 {
return fmt.Errorf("no files to send")
}

err = stream.Send(&applicationpkg.ApplicationManifestQueryWithFilesWrapper{
Part: &applicationpkg.ApplicationManifestQueryWithFilesWrapper_Query{
Expand Down

0 comments on commit 6f5eaff

Please sign in to comment.