Skip to content

Commit

Permalink
fix: surface errors when compressing files (argoproj#13491) (argoproj…
Browse files Browse the repository at this point in the history
…#13494)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: schakrad <58915923+schakrad@users.noreply.github.com>
  • Loading branch information
2 people authored and schakrad committed Jul 24, 2023
1 parent e0e0d7e commit 3087efb
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
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
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

0 comments on commit 3087efb

Please sign in to comment.