Skip to content

Commit

Permalink
fix CMPs, ineffectual err
Browse files Browse the repository at this point in the history
Signed-off-by: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com>
  • Loading branch information
notfromstatefarm committed Jul 18, 2022
1 parent b864cdc commit 1ca3f48
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co

f, checksum, err := stream.CompressFiles(local, nil)

errors.CheckError(err)

err = client.Send(&applicationpkg.ApplicationManifestQueryWithFilesWrapper{
Part: &applicationpkg.ApplicationManifestQueryWithFilesWrapper_Query{
Query: &applicationpkg.ApplicationManifestQueryWithFiles{
Expand Down
21 changes: 19 additions & 2 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,29 @@ func (s *Service) GenerateManifestWithFiles(stream apiclient.RepoServerService_G
return &operationContext{appPath, ""}, nil
}, req)

var res *apiclient.ManifestResponse
tarConcluded := false

select {
case err := <-promise.errCh:
return err
case tarDone := <-promise.tarDoneCh:
tarConcluded = tarDone
case resp := <-promise.responseCh:
stream.SendAndClose(resp)
return nil
res = resp
}

if tarConcluded && res == nil {
select {
case resp := <-promise.responseCh:
res = resp
case err := <-promise.errCh:
return err
}
}

err = stream.SendAndClose(res)
return err
}

type ManifestResponsePromise struct {
Expand Down Expand Up @@ -1615,6 +1631,7 @@ func generateManifestsCMP(ctx context.Context, appPath, repoPath string, env []s
opts := []cmp.SenderOption{
cmp.WithTarDoneChan(tarDoneCh),
}

err = cmp.SendRepoStream(generateManifestStream.Context(), appPath, repoPath, generateManifestStream, env, tarExcludedGlobs, opts...)
if err != nil {
return nil, fmt.Errorf("error sending file to cmp-server: %s", err)
Expand Down

0 comments on commit 1ca3f48

Please sign in to comment.