Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: surface errors when compressing files #13491

Merged
merged 2 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions util/cmp/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,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 @@ -40,12 +40,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